Ask Your Question

Revision history [back]

The method simplify_log seems to do the trick.

sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x

The first question is about simplyfing a symbolic expression.

The method simplify_log seems to do the trick.

sage: x, a = SR.var('x a')
sage: Ra1 = -diff(x^a, x,2)/diff(x^a, x)
sage: Ra1
-(a - 1)*x^(a - 2)/x^(a - 1)
sage: Ra1.simplify_log()
-(a - 1)/x

I suppose the second question is about SageManifolds, but I'm not sure exactly what the question is.

Maybe this can help:

  • Apply a function to all components of a tensor field https://trac.sagemath.org/ticket/29244