Ask Your Question
0

Substituting derivative in equation

asked 2015-07-29 20:21:39 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

There is likely a simple way to solve this, but I cannot seem to find a way. Let say I have two functions, f(x,y) and g(x,y)

var('x,y')

f=function('f',x,y)

g=function('g',x,y)

I want to be able to substitute a value for one of the derivatives. For example, if I have the equation x^2y+f.diff(x,1), I may want to substitute in the function g, so I have x^2y+g. I tried the following

(x^2y+f.diff(x,1)).subs(f.diff(x,1)=g)

And get an error that a keyword can't be an expression. Is there anyway to make this substitution?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-30 11:04:04 +0200

rws gravatar image

Multiplication needs *, it works for me:

sage: (x^2*y+f.diff(x,1)).subs(f.diff(x,1)==g)
x^2*y + g(x, y)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-29 20:21:39 +0200

Seen: 900 times

Last updated: Jul 30 '15