Message Boards Message Boards

0
|
3482 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

FindMinimum refuses to evaluate a function

Posted 10 years ago

I'm trying to fit some data by using Hankel transforms on a set of basis functions, similar to FEM basis elements. I thus take the Hankel transform, apply some function on it and transform it back to real space. I defined functions that will yield the fit as a function of the basis V = {v1,v2,...,VNpt}. The transforms are defined as :

BaseTrans[rho_?NumericQ, Rm_, Npt_, V_ ] :=  NIntegrate[  BaseF[i, Rm, Npt, V] SphericalBesselJ[0, rho i], {i, 0, Rm},   Method -> {Automatic, "SymbolicProcessing" -> None},   AccuracyGoal -> 3]

EnTotFit[r_?NumericQ, Rs_, Rm_, Npt_, V_ ] :=  NIntegrate[ SphericalBesselJ[0, Rho r] (BaseTrans[Rho, Rm, Npt, V] SphericalBesselJ[0,Rs Rho] Rs^2)^2 Rho^2, {Rho, 0, 10},   Method -> {Automatic,     "SymbolicProcessing" -> None}, AccuracyGoal -> 3]

Where BaseF evaluates the sum of the basis functions with weights vi. These function yield back good results even if it takes a while to compute the second transform (~20 sec). I planned to make the fit using :

Fits =  FindMinimum[  Sum[(EnTotFit[Da[[4 i, 1]] + 10, 5, 7,15, {v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13,v14, v15}] + Da[[4 i, 2]])^2, {i, 1, 25}], {v1, v2, v3, v4,    v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15},   AccuracyGoal -> 3, Method -> {"LevenbergMarquardt"}]

Where Da is a list containing the data, which x coordinate is shifted by 10. I have 100 points, but I tried fitting only 25 at first. However this function completely fails. If i use LevenberMarquardt as the method, it tells me by function is not a least square minimization, and if I use any other method, it simply refuses to evaluate the EnTotFit function and tells me the grad is zero at starting point. If i use NMinimize, it uses zero as the value of the function and generates the output in ~0.5 sec (which does not make any sense).

Does anyone have an idea as to why this FindMinimum fails ?

POSTED BY: Martin Girard

If you don't give FindMinimum starting values for the variables, it uses 1.0 for all of them. Sounds like that's a bad starting point.

POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract