Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica:Having problem with my calculation(numerical)

  1. Aug 14, 2010 #1
    What wrong with my calculation.the problem is from the attachment.
    It keeps saying

    NMinimize::nnum:The function value .........is not a number at {x1,x2}=.....

    given x0=0 and x3=5

    Attached Files:

    Last edited: Aug 14, 2010
  2. jcsd
  3. Aug 14, 2010 #2


    User Avatar
    Science Advisor

    Did you tell it what Y (capital Y) is? If so, you didn't tell us. NMinimize needs to know all of the values, it can't deal with variables.
  4. Aug 14, 2010 #3

    Out[4]={4.457054464608864`*10^8, {x1 -> 0.06690213249753463`, x2 -> 1.1629357790698616`}}

    If I did not make an error typing this all back in again then I cannot explain what your problem is. But I believe you have larger problems than this. Quit kernel and restart

    H[x_,y_]:=Integrate[a*(E^(-d*t)*(E^(d*t)*(b-c*t)+ E^(a*y)*(-b+c*y)))^2,{t,x,y}];
    NMinimize[{27+3*(F[x0,x1]+F[x1,x2]+F[x2,x3])+ 1/5*(H[x0,x1]+H[x1,x2]+H[x2,x3]),x0≤x1&&x1≤x2&&x2≤x3},{x1,x2}]

    Out[4]={7.388367735069655`*10^6, {x1 -> 2.4650125379662637`, x2 -> 3.9306108222644514`}}

    So very tiny changes in your coefficients give very different results.

    I would suggest you spend a few days reading about the details of approximate and exact and machine precision mathematics as provided by Mathematica. Much of that is probably not what you would expect it to be.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook