Simplification or equality check



Sorry, I meant radcan(imagpart(root))


On Sun, Mar 31, 2013 at 10:57 AM, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> Comments in line.
>
>
> On Sat, Mar 30, 2013 at 10:51 PM, Thomas D. Dean <tomdean at speakeasy.org>wrote:
>
>> eq:2*x^3-x^2*y+y^3-1=0; p:[2,-3];
>>
>> eq1:''rhs(first(solve(diff(eq,**x),diff(y,x))));
>>
>
> ^^^ Presumably there is a depends(y,x) before this.  Or use 'diff(y,x).
> ^^^ Why are you using [''] (two single quotes) here?  In this case, it has
> no effect at all.
> ^^^ Why are you looking at the first solution only?  The order of the
> solutions is arbitrary.
>
>
>
>> df(x,y):=''eq1;
>>
>
> ^^^ This is an appropriate use of [''], though I'd recommend define
> instead, since it works equally well in programmatic cases.
>
>
>> pointslope(p,m):=y-p[2]=m*(x-**p[1]);
>> eq2:pointslope(p,df(p[1],p[2])**);
>> soln:rhs(first(solve(eq2,y)));
>>
>> eq3:last(factor(solve(eq,y))); /* choose the real solution */
>> plot2d([rhs(eq3),soln],[x,-4,**4],[y,-10,10]);
>>
>> Here is my problem.
>>
>> eq3:factor(solve(eq,y));
>> eq has three solutions for y.  How do I choose the right one?  I used the
>> if statement for simpler results.  But, I cannot reduce this to equality.
>>
>> I have been searching for a way to tell if any parts of eq3 are real.
>>
>
> Better to do the solve after substituting specific values, rather that
> substituting values into the result.  The result is more likely to be
> tractable that way.  Then you can check whether imagpart(root)=0.  In this
> case, the roots are messy; you'll want imagpart(radcan(root)).
>
> float(subst([x=p[1],y=p[2]],**eq3[1]));
>
> ^^^ apparently this refers to your second eq3.  It would have been clearer
> if you'd used different variables
>
> float(subst([x=p[1],y=p[2]],**eq3[2]));
>> float(subst([x=p[1],y=p[2]],**eq3[3]));
>>
>> if subst([x=p[1],y=p[2]],eq3[1]) then eq4:eq3[1]
>>
> elseif subst([x=p[1],y=p[2]],eq3[2]) then eq4:eq3[2]
>> elseif subst([x=p[1],y=p[2]],eq3[3]) then eq4:eq3[3];
>>
>> Is there a reasonable way to do this?
>>
>> Tom Dean
>> ______________________________**_________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>>
>
>