Jimmy

15 Reputation

7 Badges

12 years, 281 days

MaplePrimes Activity


These are replies submitted by Jimmy

@acer hi, thanks for your help and give me some useful concepts, this time it works, I try my previous data fitting using Mathematica (see here v.txt , i.txt ) and compare the result from Maple. Using Mathematica repeating trying and get i0=1.7*10^(-7),n=1.22,rs=117.

> with(Statistics);
> readdata("v.txt");
> V := Vector(%, datatype = float);
> readdata("i.txt");
> idata := Vector(%, datatype = float);
> dim := LinearAlgebra:-Dimension(V);
         dim := 200
>NonlinearFit(i0*(exp((1000*(v-i*rs))/(25.9*n))-1)-i, ``(V, idata), Vector(dim),
 [v, i], parameterranges = [i0 = 1.5*10^(-9) .. 2*10^(-5), rs = 1 .. 1000, n = 1 .. 5], 
output = [residualsumofsquares, leastsquaresfunction]);
           [0.1876434658e-3, 0.200000000000000e-4*exp(17.2368060494510*v-
1994.82773288428*i)-0.200000000000000e-4-i]
The picture is captured from my screen.

  i0=2*10^(-5)
from exp(17.2368060494510*v)=exp(1000*v/n*25.9) →get n=(1000/17.2368060494510*25.9)=2.24
from exp(-1994.82773288428*i)=exp(-1000*rs*i/n*25.9) →get rs=115.731
substitute the result into Mathematica and execute, compare the reult of Mathematica and
Maple, plot together,from the picture shows that a discrepancy with original data, 
although using Mathematica almost match well with original data, but it's time-consuming
 work to try and try,finally get the result, next time I will use the complete long formula 
to fitting other curve, I think I will spend a huge time to try the variables. 
I want to know how to solve the problem to make the result match well with the 
original data.

I have try to change the parameterranges, found that the residualsumofsquares will 
change, according the definition from Wikipedia, it says "In statistics, the residual
 sum of squares (RSS) is the sum of squares of residuals. 
It is also known as the sum of squared residuals (SSR) or the sum of squared errors 
of prediction (SSE). It is a measure of the discrepancy between the data and an
estimation model. A small RSS indicates a tight fit of the model to the data."
So,it is better to get a small residualsumofsquares value, how to minimize the value?
Thanks for your help, you really help me a lot.

 

 

@acer Hi, I try a different method to solve the unkonwn variable, I arbitrary choose three (v,i) data from the v.txt and i.txt, for example (0.5,0.00179), (1,0.00581), (1.5, 0.00991) and substitute into formula to relpace v and i,

i = i0*(exp((1000*(v-i*rs))/(25.9*n))-1) rearrange formula→ i-i0*(exp((38.61003861*(v-i*rs))/n)-1) = 0

>formula := {0.179e-2-i0*(exp((38.61003861*(0.5-0.179e-2*rs))/n)-1) = 0, 0.581e-2-i0*(exp((38.61003861*(1-0.581e-2*rs))/n)-1) = 0, 0.991e-2-i0*(exp((38.61003861*(1.5-0.991e-2*rs))/n)-1) = 0};

> solve(formula);
Warning, solutions may have been lost

How to fix the problem, thank you.

@acer Hi, I try a different method to solve the unkonwn variable, I arbitrary choose three (v,i) data from the v.txt and i.txt, for example (0.5,0.00179), (1,0.00581), (1.5, 0.00991) and substitute into formula to relpace v and i,

i = i0*(exp((1000*(v-i*rs))/(25.9*n))-1) rearrange formula→ i-i0*(exp((38.61003861*(v-i*rs))/n)-1) = 0

>formula := {0.179e-2-i0*(exp((38.61003861*(0.5-0.179e-2*rs))/n)-1) = 0, 0.581e-2-i0*(exp((38.61003861*(1-0.581e-2*rs))/n)-1) = 0, 0.991e-2-i0*(exp((38.61003861*(1.5-0.991e-2*rs))/n)-1) = 0};

> solve(formula);
Warning, solutions may have been lost

How to fix the problem, thank you.

@acer Hi, idata should be a dependent data, and V the independent data. And, yes, lowercase v is independent variable, original formula is formula

,chose left-hand-side I and first term of right-hand-side for brief discussion,i.e., i=i0{exp[q/nkT(V-i*rs)-1}, where q,k,T are known constant,and i0,rs,and n are unknown parameters,but i appear in the both side of formula, it means i=f(i,v,i0,rs,n), and i is supposed to be dependent variable. 

Oh, thank, I see the i0 goes from larger to smaller value. It's happy to discuss with you.

@acer Hi, idata should be a dependent data, and V the independent data. And, yes, lowercase v is independent variable, original formula is formula

,chose left-hand-side I and first term of right-hand-side for brief discussion,i.e., i=i0{exp[q/nkT(V-i*rs)-1}, where q,k,T are known constant,and i0,rs,and n are unknown parameters,but i appear in the both side of formula, it means i=f(i,v,i0,rs,n), and i is supposed to be dependent variable. 

Oh, thank, I see the i0 goes from larger to smaller value. It's happy to discuss with you.

Hi,@acer ,thanks for your reply that give me some useful concepts, I have try to unassign all variable and execute again, but still occur error, the following is whole process,  I don't know what could be wrong, how to solve the problem, thanks for your help.

>with(Statistics):
> readdata("v.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> V:= Vector(%, datatype = float):
>readdata("i.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
>idata := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1,V, idata, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit
 matches the arguments in call, NonlinearFit(0.3861003861e-1*i0*exp(1000*v-1000*i*rs)/n-1, 
op(w), parameterranges = [i0 = 1/1000000 .. 1/100000000, rs = 1 .. 500, n = 1 .. 5], 
output = [residualsumofsquares, leastsquaresfunction])

Hi,@acer ,thanks for your reply that give me some useful concepts, I have try to unassign all variable and execute again, but still occur error, the following is whole process,  I don't know what could be wrong, how to solve the problem, thanks for your help.

>with(Statistics):
> readdata("v.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> V:= Vector(%, datatype = float):
>readdata("i.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
>idata := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1,V, idata, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit
 matches the arguments in call, NonlinearFit(0.3861003861e-1*i0*exp(1000*v-1000*i*rs)/n-1, 
op(w), parameterranges = [i0 = 1/1000000 .. 1/100000000, rs = 1 .. 500, n = 1 .. 5], 
output = [residualsumofsquares, leastsquaresfunction])

@acer Hi, thanks for your reply, I try to change lowercase v into uppercase V as follow

> v := Vector(%, datatype = float):  into > V := Vector(%, datatype = float):

and execute again, I interchange the content i.txt and v.txt each other(sorry, my mistake),

and change the NonlinearFit, the following is whole process, it still have error occur, how to solve the problem, thank you very much.

>with(Statistics):
> readdata("v.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> V:= Vector(%, datatype = float):
>readdata("i.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
> i := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1,v, i, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Vector(200, 
{(1) = 0.486000000000000006e-5-10.00000000*rs, (2) = 0.956999999999999986e-5-20.00000000*rs, 
(3) = 0.141999999999999996e-4-30.00000000*rs, (4) = 0.186999999999999972e-4-40.00000000*rs, 
(5) = 0.231999999999999981e-4-50.00000000*rs, (6) = 0.276000000000000000e-4-60.00000000*rs, 
(7) = 0.321000000000000010e-4-70.00000000*rs, (8) = 0.365999999999999952e-4-80.00000000*rs,
 (9) = 0.410999999999999961e-4-90.00000000*rs, (10) = 0.456999999999999996e-4-100.0000000*rs,
 (11) = 0.500999999999999981e-4-110.0000000*rs, (12) = 0.550999999999999976e-4-120....

@acer Hi, thanks for your reply, I try to change lowercase v into uppercase V as follow

> v := Vector(%, datatype = float):  into > V := Vector(%, datatype = float):

and execute again, I interchange the content i.txt and v.txt each other(sorry, my mistake),

and change the NonlinearFit, the following is whole process, it still have error occur, how to solve the problem, thank you very much.

>with(Statistics):
> readdata("v.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> V:= Vector(%, datatype = float):
>readdata("i.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
> i := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1,v, i, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Vector(200, 
{(1) = 0.486000000000000006e-5-10.00000000*rs, (2) = 0.956999999999999986e-5-20.00000000*rs, 
(3) = 0.141999999999999996e-4-30.00000000*rs, (4) = 0.186999999999999972e-4-40.00000000*rs, 
(5) = 0.231999999999999981e-4-50.00000000*rs, (6) = 0.276000000000000000e-4-60.00000000*rs, 
(7) = 0.321000000000000010e-4-70.00000000*rs, (8) = 0.365999999999999952e-4-80.00000000*rs,
 (9) = 0.410999999999999961e-4-90.00000000*rs, (10) = 0.456999999999999996e-4-100.0000000*rs,
 (11) = 0.500999999999999981e-4-110.0000000*rs, (12) = 0.550999999999999976e-4-120....

Hi, Mac Dude,

I try to use NonlinearFit tool, at first I generate two file ,i.txt and v.txt to separate the i and v,then read data into vector,and use NonlinearFit, (I try a short equation,a little different with above), it show a error message, how to solve the problem? Thank you very much.

> readdata("i.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> i := Vector(%, datatype = float):
>readdata("v.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
> v := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1, i, v, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Vector(200, 
{(1) = 0.486000000000000006e-5-10.00000000*rs, (2) = 0.956999999999999986e-5-20.00000000*rs, 
(3) = 0.141999999999999996e-4-30.00000000*rs, (4) = 0.186999999999999972e-4-40.00000000*rs, 
(5) = 0.231999999999999981e-4-50.00000000*rs, (6) = 0.276000000000000000e-4-60.00000000*rs, 
(7) = 0.321000000000000010e-4-70.00000000*rs, (8) = 0.365999999999999952e-4-80.00000000*rs,
 (9) = 0.410999999999999961e-4-90.00000000*rs, (10) = 0.456999999999999996e-4-100.0000000*rs,
 (11) = 0.500999999999999981e-4-110.0000000*rs, (12) = 0.550999999999999976e-4-120....

Hi, Mac Dude,

I try to use NonlinearFit tool, at first I generate two file ,i.txt and v.txt to separate the i and v,then read data into vector,and use NonlinearFit, (I try a short equation,a little different with above), it show a error message, how to solve the problem? Thank you very much.

> readdata("i.txt");
[0.01, 0.02, 0.03, 0.04, 0.05, ...... 1.97, 1.98, 1.99, 2.]
> i := Vector(%, datatype = float):
>readdata("v.txt");
[4.86*10^(-9), 9.57*10^(-9), 1.42*10^(-8), 1.87*10^(-8), 2.32*10^(-8), ......, 0.237e-2, 
0.241e-2, 0.246e-2, 0.25e-2]
> v := Vector(%, datatype = float):
>NonlinearFit(i0*exp(1000*(v-i*rs))/(25.9*n)-1, i, v, parameterranges = [i0 = 10^(-6) .. 
10^(-8), rs = 1 .. 500, n = 1 .. 5], output = [residualsumofsquares, 
leastsquaresfunction]);
Error, invalid input: exp expects its 1st argument, x, to be of type algebraic, but received Vector(200, 
{(1) = 0.486000000000000006e-5-10.00000000*rs, (2) = 0.956999999999999986e-5-20.00000000*rs, 
(3) = 0.141999999999999996e-4-30.00000000*rs, (4) = 0.186999999999999972e-4-40.00000000*rs, 
(5) = 0.231999999999999981e-4-50.00000000*rs, (6) = 0.276000000000000000e-4-60.00000000*rs, 
(7) = 0.321000000000000010e-4-70.00000000*rs, (8) = 0.365999999999999952e-4-80.00000000*rs,
 (9) = 0.410999999999999961e-4-90.00000000*rs, (10) = 0.456999999999999996e-4-100.0000000*rs,
 (11) = 0.500999999999999981e-4-110.0000000*rs, (12) = 0.550999999999999976e-4-120....
1 2 3 Page 2 of 3