On May 21, 10:02 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:
> On Saturday, May 21, 2011 9:43:55 PM UTC-7, mankoff wrote:
>
> > I can solve basic equations for a variable without setting the LHS
> > equal to a value:
>
> > reset()
> > var('a b c')
> > f(a,b,c) = a+b+c
> > solve(f,a)
> >     a == -b - c
>
> > But slightly more complex equations don't seem to work unless I solve
> > for f==something:
>
> > reset()
> > var('a b c')
> > f(a,b,c) = a*b*c
> > solve(f,a)
> >     a == 0
>
> > How can I get the analytical solution
>
> >     a = f/(b*c)
>
> > I've tried defining my equation differently so it is a variable not a
> > function:
>
> > reset()
> > var('f a b c')
> > f = a*b*c
> > solve(f,a)
>
> > None of these seem to work.
>
> > I can add an 'x' to the var list and then this works a bit:
> > solve(f==x,a)
> >     a == x/(b*c)
>
> > And now I can remember to swap x for f, but this seems like a hack. I
> > tried using 'f' instead of 'x'
>
> > solve(f==f,a)
>
> > but just get the strange solution
>
> >     a == r1
>
> > I'm new to Sage so I hope there is something obvious I'm missing.
>
> The first argument to "solve" should be an equation, so try this:
>
> sage: var('f a b c')
> sage: solve(f==a*b*c, a)
> [a == f/(b*c)]
>
> It looks like if you don't include an equation, just a symbol, it sets it to
> zero and solves that equation.  (This explains your first two examples.)  I
> don't know if this is intentional behavior; it's safer to explicitly include
> both sides of the equation.
>

Got it:

eqn = f == a*b*c
solve(eqn,a)

Thanks,

   -k.

-- 
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