On 3 říj, 23:22, "ma...@mendelu.cz" <ma...@mendelu.cz> wrote:
>
> I have not enought skill in Python, Sage, hg and related thinks. Is
> there any person interested in the problem, which sould like to try
> this?
The following code works in Sage
y=function('y',x)
k1,k2=var('k1 k2')
x0,y0,y1=0,1,2 # initial conditions y(x0)=y0 and y'(x0)=y1
eq=diff(y,x,2)+3*diff(y,x)-4*y==exp(x)
A=desolve(eq,y)
sols_k=solve([y0==A.subs(x=x0),y1==diff(A,x).subs(x=x0)],
[k1,k2],solution_dict=True)
A=A.subs(k1=sols_k[0][k1]).subs(k2=sols_k[0][k2])
A
So I think that the following lines from definition of desolve in Sage
(obtained from desolve??)
ics = to_eqns([ivar, dvar, dvar.derivative(ivar)], ics)
soln = soln.ic2(*ics)
could be replaced by something like
sols_k=solve([ics[1]==soln.subs(x=ics[0]),ics[2]==diff(soln,x).subs
(x=ics[0])],\ [k1,k2],solution_dict=True)
soln=soln.subs(k1=sols_k[0][k1]).subs(k2=sols_k[0][k2])
and this should work at least for linear second order ODE, where IVP
has unique solution (I am not sure if desolve solves also some
nolinear ODE's). Perhaps with a test that the solution sols_k exists
and is unique (which is IMHO allways true for linear ODE's).
Yours sincerelly
Robert Marik
>
> Robert Marik
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---