Ask Your Question

# Substituting derivative in equation

asked 2015-07-29 20:21:39 +0200 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 close merge delete

## 1 Answer

Sort by » oldest newest most voted

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)

more

## Your Answer

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

Add Answer

## Stats

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

Seen: 558 times

Last updated: Jul 30 '15