Solve for y when [x=-10, x=10] and d=5



"William Porter" <wmporter.omegapar at comcast.net> writes:
<snip>
> (%i2) e2: solve(e1, y);
>
>                                               2        2
>
>                                              x  - 4 d
>
> (%o2)                          [y = - ---------]
>
>                                                 4 d
>
> I know that .
>
> (%i3) e3: subst([y=0, d=5], e1);
>
>                                          2
>
> (%o3)                              x  - 100
>
> (%i4) e4: solve(e3, x);
>
> (%o4)                         [x = - 10, x = 10]
>
>  
>
> (%o3) and (%o4) lines are correct. But I need to assign a value to x for
> example x=[-10,10] and d:5 to determine y value. I know that the answer is
> y=0. Another example is x=[-50,50] and d:50. I know that the answer is
> y=37.5. The problem is I am lost as how to solve this issue.

Well, there are sort of two solutions, except for the fact that the
equation for y has an x^2, so it doesn't matter.

The long-hand way of doing it could be something like the following:

(%i6) subst([x=rhs(first(e4)), d=5], first(e2));
(%o6)                                y = 0

which is pretty horrible. If it wasn't obvious that it didn't matter
which of the two solutions in e4 you chose, you could even do something
like

(%i7) makelist(subst([x=rhs(eq), d=5], first(e2)), eq, e4);
(%o7)                           [y = 0, y = 0]

which sort of maps the solution across e4 (note, you could also do this
with the map function, but that would be even more cumbersome).

Instead of using subst, you could use ev, which has bizarre semantics
and (in my opinion) the best way to check how it works is to use it
until you get something sensible... Longhand, the equivalent of my first
example would be

(%i8) ev(first(e2), first(e4), d=5);
(%o8)                                y = 0

But, even easier, there's a shortcut for calling ev so you can actually
write

(%i5) first(e2), first(e4), d=5;
(%o5)                                y = 0

Tada!



Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20100725/64d0a408/attachment-0001.pgp>;