# Question:Minimizing the result of a numerical integral - Optimization:-Minimization

## Question:Minimizing the result of a numerical integral - Optimization:-Minimization

Maple

Based on an answer to a question posted on MaplePrimes, which I am I able to locate through the search system, but that I know it is recent, I am trying to calculate the parameters of a function which minimizes the result of a numerical integral. The function, f1(x), is well defined. The function f2(x) has two parameters, K and r. The integral of the square of the difference between the two function cannot be solved symbolically. Hence my plan is to use the Minimization function in Optimization to determine the values of K and r.

The attached worksheet includes two examples - a practice example for me to become familiar with using Optimization:-Minimization for an integral and the actual problem I am attempting to solve. Note: it was only through MaplePrimes that I learned the function must be defined through a procedure. Here is what I discovered in my experiments:

* the command to perform the numerical integration requires the small "i" verion of int, not Int, i.e evalf( int( function, limits )), not evalf(Int(..)).  This seems to be inconsistent with the documentation. Can someone explain why it is this way?

* The function must be defined locally. If I try to use a globally defined function, non-numeric results are encountered. Is there a way to integrate a global function?

* For the practice problem, it works as long as I abide by the conditions in the previous 2 bullet points.

* When I try to solve the real problem, which appears to be solvable by eyeballing some graphs (included), the kernal is lost.  This is repeatable for me. Do others experience this problem?