Originally Posted by
laureanda
Hello,
this is the entire code:
> with(CurveFitting);
> with(plots);
> with(Optimization);
> F := diff(X(t), t) = X(t)*(A-B*Y(t));
> G := diff(Y(t), t) = Y(t)*(C*X(t)-E);
> f := diff(x(t), t) = x(t)*(a-b*y(t));
> g := diff(y(t), t) = y(t)*(c*x(t)-e);
>
>
> x0 := .4; y0 := .5; a := 1.8; b := .4; c := .2; e := .8;
0.4
0.5
1.8
0.4
0.2
0.8
> solnum := dsolve([f, g, x(0) = x0, y(0) = y0], [x(t), y(t)], numeric, range = 0 .. 10);
>
> h(t):=e log(x(t))- c x(t)- b y(t)+a log (y(t)) : ;
> plot(t, h);
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
> H(t,A,B,C,E):=E log(x(t))- C x(t)- B y(t)+A log(y(t)) : ;
> Er(t,A,B,C,E,T):=1/(2)*(H(t,A,B,C,E) - T)^(2) ;
1 2
(t, A, B, C, E, T) -> - (H(t, A, B, C, E) - T)
2
> Er(t, a, b, c, e, 1);
1 2
- (0.8 ln(x(t)) - 0.2 x(t) - 0.4 y(t) + 1.8 ln(y(t)) - 1)
2
>
*****************************
Note: I have used 2 function (f and F, g and G) because I try to find the parameters a,b,c,e having only "solnum", like "experimental data", so f and g make the numerical solution, F and G have A,B,C,E unknown.