perhaps, no subst is necessary:

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)
show(H)
coef_sigma=(H.coeff(sigma^2))
show(coef_sigma)
show(H)
H=H-(coef_sigma-epsilon)*sigma^2
show(H)
H=H.collect(sigma^2)
H

R.M.

On 8 říj, 15:27, Ranjit <rjcha...@gmail.com> wrote:
> Sorry I should make my question clearer. I'm not trying to substitute
> for sigma^2. What I want to do is replace the various constants
> multiplying the terms in sigma with a single constant. For example  I
> get the following term in sigma^2:
>
> -1/2*(1/R^2 - beta_0/(R^2*beta))*sigma(r)^2
>
> And I want to get:
>
> -epsilon*sigma(r)^2
>

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

Reply via email to