Reputation: 157
I don't know if this feature exists or if symbolic is the right name for it.
I want to be able to have a variable, say f, for a (math) function with certain properties. I want to be able to use this variable in expressions. But I don't actually want to define what the function f does.
For example, I might want to say "define f to be a function in one variable that is differentiable on the real numbers". Then I want to be able to use f(x) in expressions. I might want to define another function g(x) in terms of f(x) and be able to differentiate g(x) and get an expression from sage. So I want to issue the following commands
f is defined as before
define g(x)=(f(x))^2
differentiate g
output: g'(x)=2f(x)f'(x)
Does this feature exist?
Upvotes: 3
Views: 862
Reputation: 1696
How about this:
sage: f = function('f')
sage: g(x) = f(x)**2
sage: g.derivative()
x |--> 2*f(x)*diff(f(x), x)
Upvotes: 3