[sage-support] Re: Completing the square

2009-09-03 Thread Mikie
Here is the finished product for CS. -- def CSquare(co1,co2,co3): eq1=co1*x^2+co2*x+co3 eq3=eq1==0 eq2=factor(eq1) eq4=(1/co1)*eq2 eq10=expand(eq4) M1=maxima.args(eq10);L1=len(M1) Cof1=maxima.args(eq10);Cof1a=Cof1[2];

[sage-support] Re: Completing the square

2009-09-02 Thread Robert Bradshaw
On Wed, 2 Sep 2009, calcp...@aol.com wrote: > That's a good question! I've written functions in MATLAB (well Octave > actually) no problem. But I get confused where Python leaves off and Sage > kicks in when witting functions here. The way to think about this is that Sage is just a huge Python

[sage-support] Re: Completing the square

2009-09-02 Thread CalcPage
That's a good question! I've written functions in MATLAB (well Octave actually) no problem. But I get confused where Python leaves off and Sage kicks in when witting functions here. Could someone please give me a barebones example, soup to nuts, of a Python vs. Sage vs. Other (Maxima and

[sage-support] Re: Completing the square

2009-09-02 Thread Mikie
No. The call is CSquare(2,3,4). Just trying to setup a random quad. Could this function be done with just Sage? I need coeficients, each term, sides of the equation, etc. On Sep 2, 1:01 pm, William Stein wrote: > On Wed, Sep 2, 2009 at 10:48 AM, kcrisman wrote: > > > On Sep 2, 1:32 pm, Mikie

[sage-support] Re: Completing the square

2009-09-02 Thread William Stein
On Wed, Sep 2, 2009 at 10:48 AM, kcrisman wrote: > > > > On Sep 2, 1:32 pm, Mikie wrote: > > Here is my start using Sage and Maxima. > > > > def CSquare(co1,co2,co3): > > eq1=co1*x^2+co2*x+co3 > > eq3=eq1==0 > > eq2=factor(eq1) > >

[sage-support] Re: Completing the square

2009-09-02 Thread kcrisman
On Sep 2, 1:32 pm, Mikie wrote: > Here is my start using Sage and Maxima. > > def CSquare(co1,co2,co3): >     eq1=co1*x^2+co2*x+co3 >     eq3=eq1==0 >     eq2=factor(eq1) >     eq4=(1/co1)*eq2 >     Cof1=maxima.args(eq4);Cof1a=Cof1[2]; >     val2

[sage-support] Re: Completing the square

2009-09-02 Thread Mikie
Here is my start using Sage and Maxima. def CSquare(co1,co2,co3): eq1=co1*x^2+co2*x+co3 eq3=eq1==0 eq2=factor(eq1) eq4=(1/co1)*eq2 Cof1=maxima.args(eq4);Cof1a=Cof1[2]; val2=real(((1/2)*(maxima.coeff(eq4,x,1 val1=val2^

[sage-support] Re: Completing the square

2009-09-02 Thread Robert Bradshaw
On Wed, 2 Sep 2009, Mikie wrote: > > Here is a proc(Mupad) I wrote for showing the steps in completing the > square for a quad > > //Completing the Square Method of solving quadratic equation > quad:= proc(co1,co2,co3) >local a,b,c,eq1,q1,L