# What is wrong?

Posted 9 years ago
1589 Views
|
5 Replies
|
0 Total Likes
|
 Hi,I'm using Mathematica 9.  I made some code (full code update): Data = Import["E:\\EuFe2As2-based\\Math\\Cp\\Cp_Eu12A1_t4", "Table"]; pun = Select[Data,  First[#] > 150 &]; ListPlot[pun] CDeb[n_, t_, thD_] = n*9*8.31 (t/thD)^3 Integrate[ x^4 Exp[x]*(Exp[x] - 1)^-2, {x, 0, thD/t}]; CEl[t_, gamma_] = gamma*t; Cp[n_, t_, thD_, gamma_] = CDeb[n, t, thD] + CEl[t, gamma]; n = 5; fitt = FindFit[pun, Cp[n, T, ThetaD, GammA], {{ThetaD, 330}, {GammA, 0.1}}, T]; modelFunk = Function[{T}, Evaluate[Cp[n, T, ThetaD, GammA] /. fitt]];Plot[modelFunk[T], {T, 0, 300}, Epilog -> Map[Point, pun]]tablica = Table[{Temp, Re[CEl[Temp, GammA] /. fitt], Re[CDeb[n, Temp, ThetaD] /. fitt], Re[modelFunk[Temp]]}, {Temp,   0.1, 30, 5];Export["c:/daneCp.csv", tablica, "CSV"]and in the line with the FindFit I got somthing like this:FindFit::nrlnum: The function value {Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined} is not a list of real numbers with dimensions {39} at {ThetaD,GammA} = {330.,0.1}. >>FindFit::nrlnum: The function value {Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined,Undefined} is not a list of real numbers with dimensions {39} at {ThetaD,GammA} = {330.,0.1}. >>I have no idea what's going on with it. The line with FindFit works fine in mathematica 7, but in 9 doesn't.  Any suggestions?
5 Replies
Sort By:
Posted 9 years ago
 "pun" is not defined the way you want. FindFit::nrlnum: The function value {Undefined,Undefined,..,Undefined,Undefined} is not a list of real numbersPreviously, your code defined the list "pun" by inserting "Undefined" everywhere.  In[1]:= ?Undefined                                                                      Undefined is a symbol that represents a quantity with no defined value.You should consider attaching a complete notebook that works in Mathematica 7.  Verify that you can open Mathematica, run only the notebook, and get the right results.
Posted 9 years ago
 The code has been updated
Posted 9 years ago
 Hi Taksido,Please insert your code in a spikey box, like this:eq = a x + b/(1 + Exp[-c (x - x0)]) + d;The text editor does funny things, but the spikey box preserves code we can see, and cut and paste.Best,David
Posted 9 years ago
 What does Exp mean in your definition for CDeb?Please first check that your functions, CDEB, CDEI and Cp all work as you intend them to.
Posted 9 years ago
 exp(x) but you can't see it here.  I don't know why.  As i said, everything works fine in Mathematica 7, but not 9, there is always a problem with FindFit. Some problems with Theta and GammA but what? Syntax?  I don't know where.