Results 1 to 6 of 6

Math Help - ODE in Maple

  1. #1
    Newbie
    Joined
    Jun 2009
    Posts
    8

    ODE in Maple

    Hello,
    sorry for my English...
    I have a problem with Maple 12 in ODE:
    I have 2 ODE f and g; I use the procedure

    solnum := dsolve([f, g, x(0) = x0, y(0) = y0], [x(t), y(t)], numeric, range = 0 .. 10)

    then, I would like to use x(t) and y(t) in an other function

    h(t):=E log(x(t))- C x(t)- B y(t)+A log (y(t)) :

    (A,B,C,E are parameters) but Maple say that he "don't know" x(t) and y(t): how I could say to it that x and y are the same of "solnum"?
    (I used first "subs" but in this way h(t) becomes discrete and not a continous function).

    Thank you very much,


    Ilaria
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Jester's Avatar
    Joined
    Dec 2008
    From
    Conway AR
    Posts
    2,325
    Thanks
    8
    Quote Originally Posted by laureanda View Post
    Hello,
    sorry for my English...
    I have a problem with Maple 12 in ODE:
    I have 2 ODE f and g; I use the procedure

    solnum := dsolve([f, g, x(0) = x0, y(0) = y0], [x(t), y(t)], numeric, range = 0 .. 10)

    then, I would like to use x(t) and y(t) in an other function

    h(t):=E log(x(t))- C x(t)- B y(t)+A log (y(t)) :

    (A,B,C,E are parameters) but Maple say that he "don't know" x(t) and y(t): how I could say to it that x and y are the same of "solnum"?
    (I used first "subs" but in this way h(t) becomes discrete and not a continous function).

    Thank you very much,


    Ilaria
    Show us your entire code.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jun 2009
    Posts
    8
    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.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Jester's Avatar
    Joined
    Dec 2008
    From
    Conway AR
    Posts
    2,325
    Thanks
    8
    Quote Originally Posted by laureanda View Post
    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.
    One potential problem I see (I haven't checked this though) is the way you define h(t)

    you have

    > h(t):=e log(x(t))- c x(t)- b y(t)+a log (y(t)) : ;

    I think it should be

    > h:=(t)->e log(x(t))- c x(t)- b y(t)+a log (y(t)) ;

    Similarly for H and Er.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jun 2009
    Posts
    8

    Unhappy

    I changed the code, but the problem remain. Probably Maple don't understand that the x and y in h are the same of solnum, but I don't know how to explain it to the program!
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Jun 2009
    Posts
    8
    Eureka!!!!


    > xx(s):=subs(solnum(s),x(t)):yy(s):=subs(solnum(s), y(t)):
    >
    > h(s):=e log(xx(s))- c xx(s)- b yy(s)+a log(yy(s)) : ;
    > plot(h);


    Maple wants an other variable: I used "s" and it do its work eheheh!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: November 30th 2011, 02:25 PM
  2. Maple Help
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 16th 2010, 08:47 AM
  3. Maple or other
    Posted in the Math Software Forum
    Replies: 0
    Last Post: March 6th 2010, 08:14 AM
  4. Maple 12
    Posted in the Math Software Forum
    Replies: 0
    Last Post: November 14th 2009, 05:50 PM
  5. Maple 11
    Posted in the Math Software Forum
    Replies: 10
    Last Post: April 10th 2008, 06:56 PM

Search Tags


/mathhelpforum @mathhelpforum