Beginner 'apply' question



On 12/28/06, Phil <pbpublist at comcast.net> wrote:

> I'm attempting to solve a simple equation in terms of known variables
> and then calculate the value of the unknown by applying the known.  For
> example, given a^2+b^2=c^2, a and c are the known variables with values
> of 3 and 5.

After computing the solution [b = ..., b = ...] you want to re-evaluate it
with a and c assigned some specified values. There are a few ways to
accomplish that.

(%i1) display2d : false;
(%o1) false
(%i2) e1 : a^2 + b^2 = c^2;
(%o2) b^2+a^2 = c^2
(%i3) solve (%, b);
(%o3) [b = -sqrt(c^2-a^2),b = sqrt(c^2-a^2)]
(%i4) ev (%o3, a = 3, c = 5);
(%o4) [b = -4,b = 4]
(%i5) ''%o3, a = 3, c = 5;
(%o5) [b = -4,b = 4]
(%i6) a : 3;
(%o6) 3
(%i7) c : 5;
(%o7) 5
(%i8) ''%o3;
(%o8) [b = -4,b = 4]

Note that '' is two single quotes (not a double quote).

Hope this helps,
Robert Dodier