On 7 říj, 16:21, Ranjit <[email protected]> wrote:
> I'm trying to figure out how to do a simple substitution. I've the
> following code:
>
> var('r beta beta_0 R a h')
> psi=function('psi',r)
> sigma=function('sigma',r)
>
> H_0=function('H_0',r)
>
> H_grad = lambda psi : (1/2)*(beta/beta_0)*R^2*(psi.diff(r))^2
> H_0(psi) = -(1/2)*(beta/beta_0-1)*psi^2 + beta*a*psi^4 + beta*h*psi
>
> H_1=H_grad((1/R)*(beta_0/beta)^(1/2)*sigma)
> H=H_1+H_0((1/R)*(beta_0/beta)^(1/2)*sigma)
>
> H=H.simplify_radical().expand().collect(sigma^2)
> H
>
> Let's say I want to rewrite the coefficient on sigma^2 as simply
> epsilon, how can I do that?
>

perhaps like this (I used alpha indstead of epsilon)

alpha=function('alpha',r)
H.subs_expr(sigma==sqrt(alpha)).subs_expr(diff(sigma)==diff(sqrt
(alpha)))

Not exactly what you want, but similar.

BTW: When looked at this problem, the notation D[0](alpha)(r)^2  seems
to be unusual to me.
Is it possible to fix sage so that it prints derivatives of functions
in one variable
as usual: alpha'(r) ?

And is it possible to get sin^2(x) ans (alpha'(r))^2 in LaTeX output
instead of sin(x)^2 and y'(r)^2?

Robert Marik

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to