Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Forcing Prime Notation

asked 12 years ago

hwong557 gravatar image

I want sage to implicitly differentiate a function for me, say

d/dx f(x)^2 = 2f(x)* f'(x).

I can do this by entering:

var('x')
f=function('f', x)
(f^2).diff(x)

This returns

2 f(x) D[0] (f) (x)

which is correct, but hard for me to read. Can I make sage return:

2 f(x) f'(x)

Thanks.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 12 years ago

You can try the patch attached to issue #6344. It is more than 3 years old, so some work might be needed to make it apply to a recent Sage version, but it essentially does exactly what you need. See this comment for some examples.

Preview: (hide)
link

Comments

"However, I think we should settle on an output style ASAP, without letting too many releases go by." Oops. Perhaps this is still worth changing? Would we need deprecation?

kcrisman gravatar imagekcrisman ( 12 years ago )
1

answered 12 years ago

achrzesz gravatar image

updated 12 years ago

kcrisman gravatar image

This is easy to read:

sage: maxima('diff(f(x)^2,x)')                 
2*f(x)*'diff(f(x),x,1)

And

sage: from sympy import *                      
sage: x=Symbol('x')      
sage: f=Function('f')    
sage: diff(f(x)^2,x)     
2*f(x)*Derivative(f(x), x)

Also:

sage: maxima_console()
(%i1) derivabbrev:true;
(%o1)                                true
(%i2) diff(f(x)^2,x);
(%o2)                            2 f(x) f(x)
                                            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: 12 years ago

Seen: 518 times

Last updated: Nov 26 '12