Thank you very much for replying.
The given problem is real life problem and I need to solve as it is. Any
way, is interesting idea you gave me, I will see after plugging the system
directly into Maxima also.

Thanks in advance,

Amsale.


On Tue, Sep 22, 2009 at 2:36 PM, David Joyner <[email protected]> wrote:

>
> Just a guess: your system is non-linear and that causes a problem somehow.
>
> If you modify the linear terms you get
>
>
> sage: t = var('t')
> sage: z = function('z',t)
> sage: y1= function('y1',t)
> sage: y2= function('y2',t)
> sage:
> sage: b = 3/100; r1 = 6; r2 = 1/2; gamma = 1/100; ro = 6;
> sage: De1 = diff(z,t) - b + (r1*y1 + r2*y2 + b - gamma*z) == 0
> sage: De2 = diff(y1,t)-(r1*y1+r2*y2) + (ro+b-gamma)*y1 == 0
> sage: De3 = diff(y2,t)-ro*y1+gamma*y2+y2*b == 0
> sage: desolve_system([De1, De2, De3], [z, y1, y2])
>
> [z(t) == -10/59971999*((120820*y1(0) +
> 10799*y2(0))*sqrt(30001)*sinh(1/100*sqrt(30001)*t) + 30001*(220*y1(0)
> + 201*y2(0))*cosh(1/100*sqrt(30001)*t))*e^(-3/100*t) +
> 1/1999*(1999*z(0) + 2200*y1(0) + 2010*y2(0))*e^(1/100*t),
>  y1(t) == 1/30001*((y1(0) +
> 50*y2(0))*sqrt(30001)*sinh(1/100*sqrt(30001)*t) +
> 30001*cosh(1/100*sqrt(30001)*t)*y1(0))*e^(-3/100*t),
>  y2(t) == 1/30001*((600*y1(0) -
> y2(0))*sqrt(30001)*sinh(1/100*sqrt(30001)*t) +
> 30001*cosh(1/100*sqrt(30001)*t)*y2(0))*e^(-3/100*t)]
>
> which runs fine.
>
> I really don't know the problem though. desolve_system? says this calls
> Maxima.
> What happens if you plug your system directly into Maxima?
>
> On Tue, Sep 22, 2009 at 8:01 AM, AMSALEWORK EJIGU
> <[email protected]> wrote:
> >
> > Hi
> >
> > I have previously solved this problem using odesolve from scipy.
> > I am now learning SAGE.
> >
> > What is wrong here? I get zerodivision from SAGE but it had a solution
> > in odesolve.
> >
> > t = var('t')
> > z = function('z',t)
> > y1= function('y1',t)
> > y2= function('y2',t)
> >
> > b = 0.03; r1 = 6.0; r2 = 0.5; gamma = 0.01; ro = 6.0;
> >
> > De1 = diff(z,t) - b + (r1*y1 + r2*y2 + b - (gamma*y2)*z) == 0
> > De2 = diff(y1,t)-(r1*y1+r2*y2)*z + (ro+b-gamma*y2)*y1 == 0
> > De3 = diff(y2,t)-ro*y1+gamma*y2*(1-y2)+y2*b == 0
> > desolve_system([De1, De2, De3], [z, y1, y2])
> >
> >
> > I get this result:
> >
> >
> >
> > Traceback (click to the left for traceback)
> > ...
> > ZeroDivisionError: Symbolic division by zero
> >
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "/var/autofs/misc/home/amsalework/.sage/sage_notebook/
> > worksheets/admin/13/code/1.py", line 17, in <module>
> >    desolve_system([De1, De2, De3], [z, y1, y2])
> >  File "", line 1, in <module>
> >
> >  File "/usr/local/src/sage-4.1.1/local/lib/python2.6/site-packages/
> > sage/calculus/desolvers.py", line 259, in desolve_system
> >    soln[i] = sol.sage()
> >  File "/usr/local/src/sage-4.1.1/local/lib/python2.6/site-packages/
> > sage/interfaces/expect.py", line 1578, in sage
> >    return self._sage_()
> >  File "/usr/local/src/sage-4.1.1/local/lib/python2.6/site-packages/
> > sage/interfaces/maxima.py", line 1703, in _sage_
> >    return symbolic_expression_from_maxima_string(repr(self))
> >  File "/usr/local/src/sage-4.1.1/local/lib/python2.6/site-packages/
> > sage/calculus/calculus.py", line 1677, in
> > symbolic_expression_from_maxima_string
> >    return symbolic_expression_from_string(s, syms,
> > accept_sequence=True)
> >  File "/usr/local/src/sage-4.1.1/local/lib/python2.6/site-packages/
> > sage/calculus/calculus.py", line 1774, in
> > symbolic_expression_from_string
> >    return parse_func(s)
> >  File "parser.pyx", line 516, in
> > sage.misc.parser.Parser.parse_sequence (sage/misc/parser.c:3803)
> >  File "parser.pyx", line 531, in
> > sage.misc.parser.Parser.parse_sequence (sage/misc/parser.c:3689)
> >  File "parser.pyx", line 602, in sage.misc.parser.Parser.p_sequence
> > (sage/misc/parser.c:4394)
> >  File "parser.pyx", line 692, in sage.misc.parser.Parser.p_eqn (sage/
> > misc/parser.c:5101)
> >  File "parser.pyx", line 728, in sage.misc.parser.Parser.p_expr (sage/
> > misc/parser.c:5382)
> >  File "parser.pyx", line 761, in sage.misc.parser.Parser.p_term (sage/
> > misc/parser.c:5605)
> >  File "parser.pyx", line 803, in sage.misc.parser.Parser.p_factor
> > (sage/misc/parser.c:5966)
> >  File "parser.pyx", line 830, in sage.misc.parser.Parser.p_power
> > (sage/misc/parser.c:6077)
> >  File "parser.pyx", line 884, in sage.misc.parser.Parser.p_atom (sage/
> > misc/parser.c:6525)
> >  File "parser.pyx", line 920, in sage.misc.parser.Parser.p_args (sage/
> > misc/parser.c:6924)
> >  File "parser.pyx", line 951, in sage.misc.parser.Parser.p_arg (sage/
> > misc/parser.c:7223)
> >  File "parser.pyx", line 728, in sage.misc.parser.Parser.p_expr (sage/
> > misc/parser.c:5382)
> >  File "parser.pyx", line 771, in sage.misc.parser.Parser.p_term (sage/
> > misc/parser.c:5721)
> >  File "element.pyx", line 1271, in
> > sage.structure.element.RingElement.__div__ (sage/structure/element.c:
> > 10502)
> >  File "expression.pyx", line 1884, in
> > sage.symbolic.expression.Expression._div_ (sage/symbolic/
> > expression.cpp:10818)
> > ZeroDivisionError: Symbolic division by zero
> >
> > regards,
> > Amsale
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to