Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Data Fitting to a System of Equations' topicStudent Support Forum > General > Archives > "Data Fitting to a System of Equations"

Help | Reply To Topic
Author Comment/Response
Eugene
10/28/09 6:06pm

Hi,

I am interested in fitting data to a function of a numerical solution of a set of non-linear equations (which I have been able to demonstrate has no closed form solution) and I am having problems coding this in Mathematica.

I have defined the following data set:

ABCexp = {9.09*10^-6, 9.37*10^-6, 7.7*10^-6, 5.21*10^-6, 3.51*10^-6,
2.35*10^-6};
Btexp = {1.11*10^-4, 1.66*10^-4, 2.49*10^-4, 3.73*10^-4, 5.63*10^-4,
8.4*10^-4};

And tried to define the following function which should give me the sum of squares of a function of a specifically selected solution to a system of equations:

se14[At_?NumberQ, Ct_?NumberQ, k1_?NumberQ, k2_?NumberQ,
alpha_?NumberQ] := sol9 ==
Exp[Plus @@
Log @@ Select[{A, B, C1} /.
Solve[{At == A + B*A/k1*(1 + C1*alpha/(k2)),
Bt == B*(1 + A/k1 + C1/k2 + (A*C1*alpha)/(k2*k1)),
Ct == C1 + B*C1/k2*(1 + A*alpha/(k1))}, {A, B, C1}],
Min[#] > 0 &]]*
alpha/(k1*k2); Apply[Plus, (ABCexp - (sol9 /. Bt -> Btexp))^2]

for which I get the following expected output:

(2.35*10^-6 - sol9)^2 + (3.51*10^-6 - sol9)^2 + (5.21*10^-6 -
sol9)^2 + (7.7*10^-6 - sol9)^2 + (9.09*10^-6 -
sol9)^2 + (9.37*10^-6 - sol9)^2

Now whenever I try to evaluate this function for example:

se14[2*10^-4, 1*10^-5, 1*10^-7, 10^-5, 2]

I get values which don't make sense. Of course this is also true when I try to find the minimum of this function as a function of one of the listed parameters.

Any help anyone could provide would be very much appreciated. Thanks,

Eugene


URL: ,
Help | Reply To Topic