On Wednesday, July 10, 2013 4:26:02 PM UTC-4, Flavio Coelho wrote:
>
> Hi,
>
> I am trying to plot the solutions the following system of ODEs
>
> var('t')
> A = function('A',t)
> B = function('B',t)
> de1 = diff(A,t) == -k1*A+k2*B
> de2 = diff(B,t) == k1*A-k2*B
>

We're missing some info here.  If I make these variables, the commands 
below don't work at all, so they must be constants of some kind.  Can you 
give values?  (Or I can use sol = 
desolve_system([de1,de2],[A,B],ics=[500,0],ivar=t) as my command.)

 

> sol = desolve_system([de1,de2],[A,B],ics=[500,0])
> show(sol)
> solA, solB = sol[0].rhs(), sol[1].rhs()
> plot((solA,solB),(t,0,50))
>
> however the solution includes A(0) and B(0) as seen below:
>
> [A(t)=111(6A(0)-5B(0))e(-1120t)+511A(0)+511B(0),B(t)=-111(6A(0)-5B(0))e(-
> 1120t)+611A(0)+611B(0)]
> How do specify the initial contidions so that my plot command above works? 
> Now I am getting the following error:
>

I'd try

sol = desolve_system([de1,de2],[A,B],ics=[0,500,0],ivar=t)

because t=0 is probably what you implicitly wanted.  An initial condition 
system doesn't necessarily start at t=0, just wherever your information is.

 

> verbose 0 (2424: plot.py, generate_plot_points) WARNING: When plotting,
> failed to evaluate function at 200 points.
> verbose 0 (2424: plot.py, generate_plot_points) Last error message:
> 'unable to simplify to float approximation'
> verbose 0 (2424: plot.py, generate_plot_points) WARNING: When plotting,
> failed to evaluate function at 200 points.
> verbose 0 (2424: plot.py, generate_plot_points) Last error message:
> 'unable to simplify to float approximation'
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to