Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Extensive replacement of trigonometric functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125220] Re: Extensive replacement of trigonometric functions
  • From: Mauro <pippo at hotmail.com>
  • Date: Wed, 29 Feb 2012 07:26:40 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jia0ik$183$1@smc.vnet.net>

I wish to thank indeed Alexei and Dana for their helpful suggestions 
(besides Andrés, of course). I am actually involved in matrix 
transformations for three-phase electric systems and in such context it 
is convenient to evidence -2pi/3 and +2pi/3 phase displacements.
I nevertheless realize that Mathematica routines are designed to fulfill 
the legitimate needs of majority, so some further work is required.
To summarize, I definitely agree with Alexei and - quoting him -
"there is no operator that would do it for you without any thinking and 
in one click".
I would only like that also all students of mine realize it!

Best regards

Mauro

 >
 > Hi, Mauro
 >
 > The form you want to achieve you cannot reach in Mathematica, since 
it simplifies the final expression according to a built-in complexity 
function.
 > Mathematica "understands" complexity not like you. Various aspects of 
this problem has been many times discussed here, you may want to look up 
the archive.
 > You may change the complexity definition, but it is difficult to find 
such a definition that would lead to the expression you want to get and 
seems to typically take more time than to work out a special trick.
 > Instead there are few ways around. What to choose depends upon your 
aim: what do you need to do with these expressions further? This is not 
clear from your post.
 > One way has been already proposed to you (see above). Another may be 
to introduce new variables like the following:
 >
 > s1=Solve[\[Theta]+(2 \[Pi])/3==\[CurlyPhi]1,\[Theta]][[1]]
 > s2=Solve[\[Theta]-(2 \[Pi])/3==\[CurlyPhi]2,\[Theta]][[1]]
 >
 > {\[Theta]->1/3 (-2 \[Pi]+3 \[CurlyPhi]1)}
 > {\[Theta]->1/3 (2 \[Pi]+3 \[CurlyPhi]2)}
 >
 > Sin[\[Theta]+\[Pi]/6] /.s1//Simplify
 > -Cos[\[CurlyPhi]1]
 >
 > Sin[\[Theta]-\[Pi]/6] /.s2//Simplify
 > Cos[\[CurlyPhi]2]
 >
 > Then you work with [\[CurlyPhi] and substitute its value on the very 
last step.
 >
 > The Presentation package of David Park offers another possibility 
enabling you to make such an operation among others. What to choose 
depends upon your aim. One thing seems clear: there is no operator in 
Mathematica that would do it for you without any thinking and in one click.
 >
 > Have fun, Alexei

>
> Hi.  I don't have a good solution, but perhaps a workaround using HoldForm...
>
> Here's a made up equation with both of your Sin examples.
>
> equ = (Sin[x + Pi/6] + 3*Tan[x] + Sqrt[2]) / (Cos[x - 1/2] + Sin[x - Pi/6]);
>
> I used just 1 rule for Sin vs your 2 rules.
>
> rule1 = Sin[x___]:>cos[Pi/2-x];
> rule2 = cos[x___]:>HoldForm[Cos[x]];
>
>
> equ /.rule1 /.rule2
>
> (Sqrt[2]+Cos[Pi/3-x]+3 Tan[x]) / (Cos[1/2-x]-Cos[Pi/3+x])
>
> To go back to using Sin, use:
> ReleaseHold[%]
>
> The following -- almost worked--, but it didn't simplify the terms inside the function.
> I don't know why.
>
> NoSin[e_]:=100*Count[e,_Sin,{0,Infinity}]
>
> FullSimplify[equ, ComplexityFunction ->  NoSin]
>
> (Sqrt[2]+Cos[1/3 (Pi-3 x)]+3 Tan[x])/(Cos[1/2 (1-2 x)]-Cos[1/3 (Pi+3 x)])
>
>
> = = = = = = = = = = = =
> HTH  :>)
> Dana DeLouis
> Mac, Math 8.0
> = = = = = = = = = = = =
>
>
>
> On Feb 17, 6:29 am, Mauro<pi... at hotmail.com>  wrote:
>> Hello to everybody.
>>
>> I have this problem: I would like to replace in a long expression all
>> the occurrences of:
>>
>> Sin[\[Theta]_ + \[Pi]/6] and Sin[\[Theta]_ - \[Pi]/6]
>>
>> with respectively:
>>
>> -Cos[\[Theta] + (2 \[Pi])/3] and Cos[\[Theta] - (2 \[Pi])/3]
>>
>> (which actually are the same thing).
>> Regretfully, the application of the rules:
>>
>> Sin[\[Theta]_ + \[Pi]/6] ->  -Cos[\[Theta] + (2 \[Pi])/3]
>> Sin[\[Theta]_ - \[Pi]/6] ->  Cos[\[Theta] - (2 \[Pi])/3]
>>
>> results in a flop, since sine functions stubbornly appear again!
>>
>> Can you help me?
>>
>> Thank you in advance
>>
>> Mauro
>
>
>




  • Prev by Date: Re: Position in the importing loop from a Web
  • Next by Date: Re: Wickham-Jones ExtendGraphics for OS X?
  • Previous by thread: Re: Extensive replacement of trigonometric functions
  • Next by thread: MathLinkException ErrorCode 11