Cloud_Chu | 5 Sep 06:01

How to simplifiy a*sin(x)+b*cos(x)


Hello Sir,

We are using WxMaxima 0.7.6 for solving some question. Now we want to change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which function I can do this simplification?

Thank you and have a nice day!
Cloud
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Judy Toth | 5 Sep 16:15
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

This is not exactly what you are looking for but it is similar.  Maybe you can find a way from this.
 
(%i1) (a+b*%i)*(c+d*%i);
(%o1) (%i*b+a)*(%i*d+c)
(%i2) polarform(%);
(%o2) sqrt((a*c-b*d)^2+(a*d+b*c)^2)*%e^(%i*atan2(a*d+b*c,a*c-b*d))
(%i3) expand(%);
(%o3) sqrt(b^2*d^2+a^2*d^2+b^2*c^2+a^2*c^2)*%e^(%i*atan2(a*d+b*c,a*c-b*d))
(%i4) factor(%);
(%o4) sqrt(b^2+a^2)*sqrt(d^2+c^2)*%e^(%i*atan2(a*d+b*c,a*c-b*d))
 
Hope this helps
 
Rich
 
------------Original Message------------
From: Cloud_Chu <at> ap.logitech.com
To: maxima <at> math.utexas.edu
Date: Fri, Sep-5-2008 0:04 AM
Subject: [Maxima] How to simplifiy a*sin(x)+b*cos(x)

Hello Sir,

We are using WxMaxima 0.7.6 for solving some question. Now we want to change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which function I can do this simplification?

Thank you and have a nice day!
Cloud
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Fateman | 5 Sep 18:14
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

try expand(trigsimp(trigexpand(    sqrt(b^2+a^2)*sin(x+atan(b/a))  )));
 
but that is in the reverse direction.  Your notion of simplification is more like complification.
 

 
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Hennessy | 5 Sep 18:26
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

Yes, but equality is reflexive so c = d is equivalent to  d=c.  It is a proof of the relation either way.  I have to agree that it is maybe a complication rather than a simplification.  I don't know a way to go in the reverse direction using Maxima.
 
 
 
 
------------Original Message------------
From: "Richard Fateman" <fateman <at> cs.berkeley.edu>
To: "'Judy Toth'" <judyt2009 <at> comcast.net>
Cc: "'Maxima List'" <maxima <at> math.utexas.edu>
Date: Fri, Sep-5-2008 12:14 PM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)
BODY { SCROLLBAR-FACE-COLOR: #c2c2c2; FONT-SIZE: 10pt; MARGIN: 5px; SCROLLBAR-HIGHLIGHT-COLOR: #ececec; SCROLLBAR-SHADOW-COLOR: #878787; COLOR: black; SCROLLBAR-ARROW-COLOR: #020202; SCROLLBAR-TRACK-COLOR: #d4d4d4; FONT-FAMILY: "Arial"; SCROLLBAR-DARKSHADOW-COLOR: #4f4f4f; SCROLLBAR-BASE-COLOR: #d4d4d4 } OL { MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px } UL { MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px } BLOCKQUOTE { MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px }
try expand(trigsimp(trigexpand(    sqrt(b^2+a^2)*sin(x+atan(b/a))  )));
 
but that is in the reverse direction.  Your notion of simplification is more like complification.
 

 
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Hennessy | 6 Sep 17:46
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

Reflexive is the wrong word.  I meant

a=b implies b=a and b=a implies a=b

I don't know what that is called.  That is what I meant.

Sorry,
Rich

------------Original Message------------
From: "Richard Hennessy"<rvh2007 <at> comcast.net>
To: fateman <at> cs.berkeley.edu
Cc: "'Maxima List'" <maxima <at> math.utexas.edu>
Date: Fri, Sep-5-2008 12:26 PM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)
Yes, but equality is reflexive so c = d is equivalent to  d=c.  It is a proof of the relation either way.  I have to
agree that it is maybe a complication rather than a simplification.  I don't know a way to go in the reverse
direction using Maxima.

------------Original Message------------
From: "Richard Fateman" <fateman <at> cs.berkeley.edu>
To: "'Judy Toth'" <judyt2009 <at> comcast.net>
Cc: "'Maxima List'" <maxima <at> math.utexas.edu>
Date: Fri, Sep-5-2008 12:14 PM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)
try expand(trigsimp(trigexpand(    sqrt(b^2+a^2)*sin(x+atan(b/a))  )));

but that is in the reverse direction.  Your notion of simplification is more like complification.

_______________________________________________ 
Maxima mailing list 
Maxima <at> math.utexas.edu 
http://www.math.utexas.edu/mailman/listinfo/maxima 
Stavros Macrakis | 5 Sep 18:46
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

On Fri, Sep 5, 2008 at 12:14 PM, Richard Fateman <fateman <at> cs.berkeley.edu> wrote:
try expand(trigsimp(trigexpand(    sqrt(b^2+a^2)*sin(x+atan(b/a))  )));
but that is in the reverse direction. 

This proves the equality, but as you say doesn't perform the transformation the user wants to perform.
 
Your notion of simplification is more like complification.

No, it is more like "transformation" to another form.  And a useful transformation.  I can't think of a straightforward way to perform this transformation in general in Maxima; I don't think the pattern matcher is powerful enough to find the appropriate subexpression of, e.g.

         a*sin(q)+b*cos(r)+c*cos(q)

without explicitly being told it is looking for terms in sin/cos(q).

             -s

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Hennessy | 6 Sep 17:50
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

"And a useful transformation."  I agree, it gives some insight into Fourier Series.

Rich

------------Original Message------------
From: "Stavros Macrakis" <macrakis <at> alum.mit.edu>
To: fateman <at> cs.berkeley.edu
Cc: "Maxima List" <maxima <at> math.utexas.edu>
Date: Fri, Sep-5-2008 12:46 PM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)
On Fri, Sep 5, 2008 at 12:14 PM, Richard Fateman <fateman <at> cs.berkeley.edu> wrote:

try expand(trigsimp(trigexpand(    sqrt(b^2+a^2)*sin(x+atan(b/a))  )));
but that is in the reverse direction. 

This proves the equality, but as you say doesn't perform the transformation the user wants to perform.

Your notion of simplification is more like complification.

No, it is more like "transformation" to another form.  And a useful transformation.  I can't think of a
straightforward way to perform this transformation in general in Maxima; I don't think the pattern
matcher is powerful enough to find the appropriate subexpression of, e.g.

         a*sin(q)+b*cos(r)+c*cos(q)

without explicitly being told it is looking for terms in sin/cos(q).

             -s

_______________________________________________ 
Maxima mailing list 
Maxima <at> math.utexas.edu 
http://www.math.utexas.edu/mailman/listinfo/maxima 
Rafał Topolnicki | 5 Sep 16:21
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

Are you sure that your simplification is correct? Plot those two 
functions for a=1,b=-10 or a=-1,b=1.
Whats more:
(%i43) e1;
(%o43) a*sin(x)+b*cos(x)
(%i44) e2;
(%o44) sqrt(b^2+a^2)*sin(x+atan(b/a))
(%i45) ratsimp(ev(e1-e2,x=0));
(%o45) -((abs(a)-a)*b)/a
%o45 is not always 0.
(%i46) ratsimp(ev(e1-e2,x=%pi/2));
(%o46) a-abs(a)
which is also different from 0.

Rafal Topolnicki

Cloud_Chu <at> ap.logitech.com pisze:
> 
> Hello Sir,
> 
> We are using WxMaxima 0.7.6 for solving some question. Now we want to 
> change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which 
> function I can do this simplification?
> 
> Thank you and have a nice day!
> Cloud
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Hennessy | 5 Sep 17:57
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

This works.

(%i4) trigexpand(sqrt(b^2+a^2)*sin(x+atan2(b,a)));
(%o4) sqrt(b^2+a^2)*((a*sin(x))/sqrt(b^2+a^2)+(b*cos(x))/sqrt(b^2+a^2))
(%i5) radcan(%);
(%o5) a*sin(x)+b*cos(x)

QED

 ------------Original Message------------
From: Rafał Topolnicki <rtopolnicki <at> o2.pl>
To: Cloud_Chu <at> ap.logitech.com
Cc: maxima <at> math.utexas.edu
Date: Fri, Sep-5-2008 10:21 AM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)

Are you sure that your simplification is correct? Plot those two 
functions for a=1,b=-10 or a=-1,b=1.
Whats more:
(%i43) e1;
(%o43) a*sin(x)+b*cos(x)
(%i44) e2;
(%o44) sqrt(b^2+a^2)*sin(x+atan(b/a))
(%i45) ratsimp(ev(e1-e2,x=0));
(%o45) -((abs(a)-a)*b)/a
%o45 is not always 0.
(%i46) ratsimp(ev(e1-e2,x=%pi/2));
(%o46) a-abs(a)
which is also different from 0.

Rafal Topolnicki

Cloud_Chu <at> ap.logitech.com pisze:
> 
> Hello Sir,
> 
> We are using WxMaxima 0.7.6 for solving some question. Now we want to 
> change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which 
> function I can do this simplification?
> 
> Thank you and have a nice day!
> Cloud
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Hennessy | 5 Sep 18:33
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

except when a = 0

Rich

 ------------Original Message------------
From: "Richard Hennessy"<rvh2007 <at> comcast.net>
To: "Rafał Topolnicki" <rtopolnicki <at> o2.pl>, Cloud_Chu <at> ap.logitech.com
Cc: maxima <at> math.utexas.edu
Date: Fri, Sep-5-2008 11:57 AM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)

This works.

(%i4) trigexpand(sqrt(b^2+a^2)*sin(x+atan2(b,a)));
(%o4) sqrt(b^2+a^2)*((a*sin(x))/sqrt(b^2+a^2)+(b*cos(x))/sqrt(b^2+a^2))
(%i5) radcan(%);
(%o5) a*sin(x)+b*cos(x)

QED

 ------------Original Message------------
From: Rafał Topolnicki <rtopolnicki <at> o2.pl>
To: Cloud_Chu <at> ap.logitech.com
Cc: maxima <at> math.utexas.edu
Date: Fri, Sep-5-2008 10:21 AM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)

Are you sure that your simplification is correct? Plot those two 
functions for a=1,b=-10 or a=-1,b=1.
Whats more:
(%i43) e1;
(%o43) a*sin(x)+b*cos(x)
(%i44) e2;
(%o44) sqrt(b^2+a^2)*sin(x+atan(b/a))
(%i45) ratsimp(ev(e1-e2,x=0));
(%o45) -((abs(a)-a)*b)/a
%o45 is not always 0.
(%i46) ratsimp(ev(e1-e2,x=%pi/2));
(%o46) a-abs(a)
which is also different from 0.

Rafal Topolnicki

Cloud_Chu <at> ap.logitech.com pisze:
> 
> Hello Sir,
> 
> We are using WxMaxima 0.7.6 for solving some question. Now we want to 
> change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which 
> function I can do this simplification?
> 
> Thank you and have a nice day!
> Cloud
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Judy Toth | 5 Sep 20:19
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

It is correct according to my computations.

Rich

 ------------Original Message------------
From: Rafał Topolnicki <rtopolnicki <at> o2.pl>
To: Cloud_Chu <at> ap.logitech.com
Cc: maxima <at> math.utexas.edu
Date: Fri, Sep-5-2008 10:21 AM
Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)

Are you sure that your simplification is correct? Plot those two 
functions for a=1,b=-10 or a=-1,b=1.
Whats more:
(%i43) e1;
(%o43) a*sin(x)+b*cos(x)
(%i44) e2;
(%o44) sqrt(b^2+a^2)*sin(x+atan(b/a))
(%i45) ratsimp(ev(e1-e2,x=0));
(%o45) -((abs(a)-a)*b)/a
%o45 is not always 0.
(%i46) ratsimp(ev(e1-e2,x=%pi/2));
(%o46) a-abs(a)
which is also different from 0.

Rafal Topolnicki

Cloud_Chu <at> ap.logitech.com pisze:
> 
> Hello Sir,
> 
> We are using WxMaxima 0.7.6 for solving some question. Now we want to 
> change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which 
> function I can do this simplification?
> 
> Thank you and have a nice day!
> Cloud
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima
Rafał Topolnicki | 5 Sep 22:10
Favicon

Re: How to simplifiy a*sin(x)+b*cos(x)

Sorry, my mistake. I misused atan and atan2 functions. You are right.

Judy Toth pisze:
> It is correct according to my computations.
> 
> Rich
> 
> 
> 
> 
>  ------------Original Message------------
> From: Rafał Topolnicki <rtopolnicki <at> o2.pl>
> To: Cloud_Chu <at> ap.logitech.com
> Cc: maxima <at> math.utexas.edu
> Date: Fri, Sep-5-2008 10:21 AM
> Subject: Re: [Maxima] How to simplifiy a*sin(x)+b*cos(x)
> 
> Are you sure that your simplification is correct? Plot those two 
> functions for a=1,b=-10 or a=-1,b=1.
> Whats more:
> (%i43) e1;
> (%o43) a*sin(x)+b*cos(x)
> (%i44) e2;
> (%o44) sqrt(b^2+a^2)*sin(x+atan(b/a))
> (%i45) ratsimp(ev(e1-e2,x=0));
> (%o45) -((abs(a)-a)*b)/a
> %o45 is not always 0.
> (%i46) ratsimp(ev(e1-e2,x=%pi/2));
> (%o46) a-abs(a)
> which is also different from 0.
> 
> Rafal Topolnicki
> 
> 
> Cloud_Chu <at> ap.logitech.com pisze:
>> Hello Sir,
>>
>> We are using WxMaxima 0.7.6 for solving some question. Now we want to 
>> change a*sin(x)+b*cos(x) into (a^2+b^2)^(1/2)*sin(x+atan(b/a)). By which 
>> function I can do this simplification?
>>
>> Thank you and have a nice day!
>> Cloud
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima <at> math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
> _______________________________________________
> Maxima mailing list
> Maxima <at> math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
> 
_______________________________________________
Maxima mailing list
Maxima <at> math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima

Gmane