How to get only real solutions?



Stavros Macrakis <macrakis at alum.mit.edu> writes:

> On Wed, Dec 12, 2012 at 10:30 AM, Piet van Oostrum <piet at vanoostrum.org> wrote:
>
>     Barton Willis <willisb at unk.edu> writes:
>    
>     >>(%i31) esolve(eq, x) := block(numer:true, defrule(r1, %i, 0),
>     >> expand(to_poly_solve(eq, x)), part(apply1(%%, r1),1))$
>     >
>     > (a) There is no guarantee ?that the first solution returned by to_poly_solve is real.
>     >
>     > (b) The function esolve globally sets numer to true; I would guess that you would like to
>     change
>     > ? ? ?the definition of esolve to something like block([numer : true], .....
>     >
>     > (c) Every time esolve is executed, the rule r1 is re-created. Actually, instead of a rule,
>     esolve
>     > could
>     > ? ? simply substitute 0 for %i.
>    
>     Thanks for these observations. I am a beginner in maxima.
>    
>     > Keepin' it real isn't easy:
>     >
>     > ? (%i3) esolve(x/sin(x)=0,x);
>     > ? part: fell off the end.
>     >
>     > ? (%i4) esolve(x^2+1,x);
>     > ? (%o4) [x=0]
>    
>     Actually I use it only for equations of the form A+Be^Ct = D, that's why
>     I called it *e*solve.
>
> In that case:
>
> esolve(a,b,c,d) := log((d-a)/b)/c
>
Well, 'form' to be taken in a more general way. It could also be:

v: v0 + v1*(1-e^(-t/R*C));
esolve (v = some_expression, t);

That;s still an equation of that general form, but to extract the proper
values a, b, c, and d would be more involved.


-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]