### exercise 26, problem 1

parent 88e6559e
 %% Cell type:markdown id: tags: %% Cell type:markdown id: tags: # Exercises 26 # Exercises 26 %% Cell type:code id: tags: # problem 1 ``` haskell (This is problem 4 of the SIAM 100-digit challenge.) Consider the function \$\$f(x, y) = e^{\sin(50x)} + \sin(60 e^y) + \sin(70\sin(x)) + \sin(\sin(80y)) - \sin(10(x+y)) + \frac{x^2 + y^2}{4}.\$\$ The function, its gradient and is Hessian are are implemented by the following Haskell functions: ```haskell f :: Double -> Double -> Double f x y = exp (sin (50*x)) + sin (60 * exp y) + sin (70 * sin x) + sin (sin (80*y)) - sin (10 * (x+y)) + (x^2 + y^2)/4 gradf :: Double -> Double -> [Double] gradf x y = [dfx, dfy] where dfx = 50 * cos (50*x) * exp (sin (50*x)) + 70 * cos x * cos (70 * sin x) - 10 * cos (10 * (x+y)) + x/2 dfy = 60 * exp y * cos (60 * exp y) + 80 * cos (80*y) * cos (sin (80*y)) - 10 * cos (10 * (x+y)) + y/2 hessf :: Double -> Double -> [[Double]] hessf x y = [[hfxx, hfxy], [hfxy, hfyy]] where hfxx = 2500 * cos (50*x) ^ 2 * exp (sin (50*x)) - 2500 * sin (50*x) * exp (sin (50*x)) - 70 * sin x * cos (70 * sin x) - 4900 * cos x ^ 2 * sin (70 * sin x) + 100 * sin (10 * (x+y)) + 1/2 hfyy = 60 * exp y * cos (60 * exp y) - 3600 * exp y ^ 2 * sin (60 * exp y) - 6400 * sin (80*y) * cos (sin (80*y)) - 6400 * cos (80*y) ^ 2 * sin (sin (80*y)) + 100 * sin(10 * (x+y)) + 1/2 hfxy = 100 * sin (10 * (x+y)) ``` ``` Try to find the global minimum of the function by solving the equation \$\$\nabla f(x, y) = 0\$\$ using e.g. Newton's method. Since the function oscillates very quickly and therefore has multiple local extrema, you should solve the equation for a sufficiently large number of initial values. It may also be useful to try to refine the set of initial points until some heuristic criterion is fulfilled. Try to formulate such a criterion. For reference, the global minimum is -3.306868647. ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!