A way to get these new parameters from maxima is as follows:
soln = S[0][0][1]
soln.arguments()
to get the argument names, (Which are t and u), then
t,u = soln.arguments()

Once you've done this, you can replace u with a value as follows:

soln.subs(u == 0.5)

Which returns:

-0.145*sin(2*pi*t) - 0.145 == 0


To get an expression that you can plot against t, you can then do:
plot(soln.subs(u == 0.5),(t,0,2*pi))

If you want to see what this would look like with a variety of values for 
u, you can do this in a loop.
plots = []
for incr in range(11):
    plots.append(plot(soln.subs(u == incr*0.1),(u,0,5)))
show(sum(plots))

Joal Heagney

On Monday, 15 October 2012 03:14:49 UTC+10, [email protected] wrote:
>
> It seems that Maxima introduces new variable %u as a parameter. 
>
> Try the following code which passes the computation directly to maxima:
>
> %maxima
> load(contrib_ode);
> eq:'diff(x,t)-x*(1-x)+a*(1+sin(2*pi*t))=0;
> contrib_ode(eq,x,t);
>
> I got:
>
> [[x='diff(%u,t,1)/%u,%u*(-a*sin(2*pi*t)-a)-'diff(%u,t,2)+'diff(%u,t,1)=0]]
>
>
>
> These new variables are always problem in Sage, since these variables are 
> not declared by var command. I think, that there is a ticket on trac with 
> this problem, which appears also when solving some equations.
>
> The code which is responsible for solving Riccati ode is in the file 
> ode1_riccati.mac in the sources of Maxima.
>
> Hope this helps
>
>
> Robert
>
>
> Dne pátek, 12. října 2012 0:37:50 UTC+2 Doaa El-Sakout napsal(a):
>>
>> I try to solve an  ODE and  plot the result as follows,
>>
>>
>> x,t,a=var('x,t,a')
>> a=0.29
>> x = function('x', t)
>> S=desolve(diff(x,t)-x*(1-x)+a*
>> (1+sin(2*pi*t)),x,contrib_ode=True,show_method=True)
>> S
>>
>> I found the following    
>> [[[x(t) == 0, (-0.29*sin(2*pi*t) - 0.29)*u == 0]], 'riccati']
>>
>> So what is this "u" here and how can I plot this and how the solution 
>> wrote by this way
>> it is not clear what does it mean 
>> Doaa
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to