Differentiate a symbolic expression

18 views
Skip to first unread message

greg1212

unread,
Jan 31, 2008, 6:52:35 AM1/31/08
to sage-forum
Hell to everyone!

I have defined the following two functions.

x2=function('x2',t)
x1=function(''x1',t)

and then i am trying to solve the following system

solve([x1==integral(x2),k*x1+diff(x2,t)==0],diff(x1,t),diff(x2,t))

getting the following response.

Exception (click to the left for traceback):
...
TypeError: cannot coerce type '<class
'sage.calculus.equations.SymbolicEquation'>' into a
SymbolicExpression.

I guess that the reason for this is that
diff((x1==integral(x2)),t)

returns with the same output message
Exception (click to the left for traceback):
...
TypeError: cannot coerce type '<class
'sage.calculus.equations.SymbolicEquation'>' into a
SymbolicExpression.


even though that
diff(integral(x2),t) returns with x2.

So i am wondering, is there a way to force sage to differentiate a
symbolic expression?
MTIA

William Stein

unread,
Jan 31, 2008, 10:09:31 PM1/31/08
to sage-...@googlegroups.com
On Jan 31, 2008 6:52 AM, greg1212 <grigori...@gmail.com> wrote:
>
> Hell to everyone!
>
> I have defined the following two functions.
>
> x2=function('x2',t)
> x1=function(''x1',t)
>
> and then i am trying to solve the following system
>
> solve([x1==integral(x2),k*x1+diff(x2,t)==0],diff(x1,t),diff(x2,t))
>
> getting the following response.
>
> Exception (click to the left for traceback):
> ...
> TypeError: cannot coerce type '<class
> 'sage.calculus.equations.SymbolicEquation'>' into a
> SymbolicExpression.
>

I don't. I get an error that Sage simply can't solve the equation:

{{{
reset()
var('t, k')

x2=function('x2',t)
x1=function('x1',t)

#and then i am trying to solve the following system

solve([x1==integral(x2), k*x1+diff(x2,t)==0],diff(x1,t),diff(x2,t))
///
...
ValueError: Unable to solve [x1(t) == integrate(x2(t), t), diff(x2(t),
t, 1) + k*x1(t) == 0] for (diff(x1(t), t, 1), diff(x2(t), t, 1))
}}}


> I guess that the reason for this is that
> diff((x1==integral(x2)),t)

That expression isn't in your input.

... Anyway, what I wish I could do is show how to solve your problem
using Sage, but unfortunately I have to do some other things right now...

>
> returns with the same output message
> Exception (click to the left for traceback):
> ...
> TypeError: cannot coerce type '<class
> 'sage.calculus.equations.SymbolicEquation'>' into a
> SymbolicExpression.


>
>
> even though that
> diff(integral(x2),t) returns with x2.
>
> So i am wondering, is there a way to force sage to differentiate a
> symbolic expression?
> MTIA
>
> >
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Reply all
Reply to author
Forward
0 new messages