Ask Your Question
1

How to take partial derivative of abstract/unknown function?

asked 7 years ago

wrenoud gravatar image

I have a function f(x) that I do not want to be expanded but wish to evaluate the partial derivative of g(x,f(x),...) with respect to x, I can not figure out how to declare the function and indicate it is a function of x without an explicit definition.

Code example:

var("x")
f = ??? # how do I define this?
g = x * f(x)
g.diff(x)

Expected output:

x * f'(x) + f(x)
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 7 years ago

wrenoud gravatar image

updated 7 years ago

I found an example in the docs after asking: Solving Differential Equations

Applying to the example given in the question though:

var("x")
f = function("f")(x)
g = x * f
g.diff(x)

Output:

x*diff(f(x), x) + f(x)
Preview: (hide)
link

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: 7 years ago

Seen: 1,814 times

Last updated: Oct 05 '17