Solutions to Homework Assignment #2

1. This can be solved by writing:

2. Golden section algorithm in Forth (what else?)

Minimum of function f(x) = –xex×sinh2(x)/[1+cosh2(x)]:
```use( f5 0e0 4e0 20 )tabulate
.000000 -.000000
.200000 -.003253
.400000 -.020859
.600000 -.055489
.800000 -.101666
1.00000 -.150270
1.20000 -.192479
1.40000 -.222515
1.60000 -.238507
1.80000 -.241696
2.00000 -.234948
2.20000 -.221470
2.40000 -.204064
2.60000 -.184862
2.80000 -.165341
3.00000 -.146443
3.20000 -.128722
3.40000 -.112465
3.60000 -.097781
3.80000 -.084670  ok
use( f5 -2e0 0e0 4e0 )golden
x_min:    1.75506
f(x_min): -.241960
number of iterations needed: 33  ok
```

Minimum of function f(x) = x4+x3+8x+8  :
```use( f4 -4e0 4e0 20 )tabulate
-4.00000 168.000
-3.60000 100.506
-3.20000 54.4896
-2.80000 25.1136
-2.40000 8.15360
-2.00000 .000000
-1.60000 -2.34240
-1.20000 -1.25440
-.800000 1.49760
-.400000 4.76160
-.000000 8.00000
.400000 11.2896
.800000 15.3216
1.20000 21.4016
1.60000 31.4496
2.00000 48.0000
2.40000 74.2016
2.80000 113.818
3.20000 171.226
3.60000 251.418
4.00000 360.000  ok
use( f4 -2e0 0e0 1e0 )golden
x_min:    -1.56578
f(x_min): -2.35434
number of iterations needed: 32  ok
```

Minimum of first function:
```use( f5 -2e0 4e0 )quadmin
x_min: 1.75506
f(x_min): -.241960
number of iterations needed: 35  ok
```

Minimum of 2nd function:

```use( f4 -2e0 2e0 )quadmin
x_min: -1.56578
f(x_min): -2.35434
number of iterations needed: 126  ok
```

4. 1-dimensional simulated annealing    What simulated annealing does

2-dimensional simulated annealing     Results of 2-dim minimization