SY

15 Reputation

3 Badges

11 years, 310 days

MaplePrimes Activity


These are questions asked by SY

Hello,

I am currently using NonliearFit to curve fit my data. 

The problem is that If I use a very long function that I should use for my project,

an error message appears as shown below.

The equation seems OK since I can plot them when parameters are set to certain values.

And if I use a simple equation NonlinearFit works fine. 

I will appreciate your helpful comments. Thank you!

-----------------------------------------------------Nonlinear_Fit_Complex_Equation.mw
 

restart 

with(Statistics) 

  X1 := Vector([0, 1, 2, 3, 4, 5, 6, 7, 8], datatype = float)

Y1 := Vector([0, -0.18e-1, -0.36e-1, -0.44e-1, -0.49e-1, -0.51e-1, -0.52e-1, -0.54e-1, -0.54e-1], datatype = float)

k__plot := proc (beta, k, t) options operator, arrow; [.1544730161*beta*(Sum((-1)^n*exp(-10000000000*Pi^2*(1+2*n)^2*k*t)*(-(1/2)/sqrt(Pi)+(1/2)*cos((1/2)*(1+2*n)*Pi)/sqrt(Pi)+(1/4)*sqrt(Pi)*(1+2*n)*sin((1/2)*(1+2*n)*Pi))/((2*Pi*n+Pi)*(1+2*n)^2), n = 0 .. infinity))+(-1)*0.1343994407e-1*beta+(-1)*0.6807477066e-1*beta*(9.869604401+8.*(Sum(-exp(-10000000000*Pi^2*(1+2*n)^2*k*t)/(1+2*n)^2, n = 0 .. infinity)))] end proc

plot0 := plot(k__plot(0.78e-1, 3*10^(-12), t), t = 0 .. 20)

 

``

``

[.1544730161*beta*(Sum((-1)^n*exp(-10000000000*Pi^2*(1+2*n)^2*k*t)*(-1/(2*sqrt(Pi))+cos((1/2)*(1+2*n)*Pi)/(2*sqrt(Pi))+(1/4)*sqrt(Pi)*(1+2*n)*sin((1/2)*(1+2*n)*Pi))/((2*Pi*n+Pi)*(1+2*n)^2), n = 0 .. infinity))-0.1343994407e-1*beta-0.6807477066e-1*beta*(9.869604401+8.*(Sum(-exp(-10000000000*Pi^2*(1+2*n)^2*k*t)/(1+2*n)^2, n = 0 .. infinity)))]

[.1544730161*beta*(Sum((-1)^n*exp(-10000000000*Pi^2*(1+2*n)^2*k*t)*(-(1/2)/Pi^(1/2)+(1/2)*cos((1/2)*(1+2*n)*Pi)/Pi^(1/2)+(1/4)*Pi^(1/2)*(1+2*n)*sin((1/2)*(1+2*n)*Pi))/((2*Pi*n+Pi)*(1+2*n)^2), n = 0 .. infinity))-0.1343994407e-1*beta-0.6807477066e-1*beta*(9.869604401+8.*(Sum(-exp(-10000000000*Pi^2*(1+2*n)^2*k*t)/(1+2*n)^2, n = 0 .. infinity)))]

(1)

  NonlinearFit([.1544730161*beta*(Sum((-1)^n*exp(-10000000000*Pi^2*(1+2*n)^2*k*t)*(-(1/2)/Pi^(1/2)+(1/2)*cos((1/2)*(1+2*n)*Pi)/Pi^(1/2)+(1/4)*Pi^(1/2)*(1+2*n)*sin((1/2)*(1+2*n)*Pi))/((2*Pi*n+Pi)*(1+2*n)^2), n = 0 .. infinity))-0.1343994407e-1*beta-0.6807477066e-1*beta*(9.869604401+8.*(Sum(-exp(-10000000000*Pi^2*(1+2*n)^2*k*t)/(1+2*n)^2, n = 0 .. infinity)))], X1, Y1, t)

Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit matches the arguments in call, 'NonlinearFit([.1544730161*beta*(Sum((-1)^n*exp(-10000000000*Pi^2*(1+2*n)^2*k*t)*(-(1/2)/Pi^(1/2)+(1/2)*cos((1/2)*(1+2*n)*Pi)/Pi^(1/2)+(1/4)*Pi^(1/2)*(1+2*n)*sin((1/2)*(1+2*n)*Pi))/((2*Pi*n+Pi)*(1+2*n)^2), n = 0 .. infinity))-0.1343994407e-1*beta-0.6807477066e-1*beta*(9.869604401+8.*(Sum(-exp(-10000000000*Pi^2*(1+2*n)^2*k*t)/(1+2*n)^2, n = 0 .. infinity)))], op(w), t)'

 

``

NonlinearFit(beta+4*t+5*exp(k*t), X1, Y1, t)

-HFloat(17.773016167748086)+4*t+5*exp(-HFloat(0.37019659804002825)*t)

(2)

``


 

Download Nonlinear_Fit_Complex_Equation.mw

 

 

 

Hello,

 

I am new to Maple.

I have a set of spreadsheet data :(x1, y1), (x2, y2) .....(xn,yn).

And I have an equation that contains an infinite series with unkowns.

e.g.) y=  A*x + sum ( B * exp(-n^2 * (x-C)) /n^2, n=1..infinity);

Where A, B, C are unkowns, which I want to get optimized values for the spreadsheet data fitting.

 

Please let me know.

Sung Yeol

Page 1 of 1