Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8584 > unrolled thread

Extensive replacement of trigonometric functions

Started byMauro <pippo@hotmail.com>
First post2012-02-17 11:29 +0000
Last post2012-02-21 11:19 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Extensive replacement of trigonometric functions Mauro <pippo@hotmail.com> - 2012-02-17 11:29 +0000
    Re: Extensive replacement of trigonometric functions andres <jarosham@gmail.com> - 2012-02-18 11:32 +0000
      Re: Extensive replacement of trigonometric functions Mauro <pippo@hotmail.com> - 2012-02-21 11:19 +0000

#8584 — Extensive replacement of trigonometric functions

FromMauro <pippo@hotmail.com>
Date2012-02-17 11:29 +0000
SubjectExtensive replacement of trigonometric functions
Message-ID<jhldmn$ouo$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#8602

Fromandres <jarosham@gmail.com>
Date2012-02-18 11:32 +0000
Message-ID<jho299$5u6$1@smc.vnet.net>
In reply to#8584
So, you don't want Mathematica to evaluate the expression -Cos[\
[Theta] + (2 \[Pi])/3]?
Since -Cos[\[Theta] + (2 \[Pi])/3] = Sin[\[Theta] + \[Pi]/6], I assume
you want to format the output for visualization purposes, because both
expressions will give the same results. If this is the case, I would
take two approaches: either apply a Hold to the rhs of the rule, or
I'd use a rule of the type Sin[\[Theta]_ + \[Pi]/6] :> -cos[\[Theta] +
(2 \[Pi])/3], so that the inexistent function "cos" keeps unevaluated.
If then you want to evaluate the expression you can release the Hold
or define cos[\[Theta]_] := Cos[\[Theta]].
Hope it helps.
Andr=E9s



On Feb 17, 6:29 am, Mauro <pi...@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

[toc] | [prev] | [next] | [standalone]


#8670

FromMauro <pippo@hotmail.com>
Date2012-02-21 11:19 +0000
Message-ID<jhvujo$87t$1@smc.vnet.net>
In reply to#8602
Thank you, Andr=E9s.
Your suggestion is undoubtfully useful for my immediate need of formula
visualization, but -more generally- I was looking for a way to direct
Mathematica transformations toward some specific desired functions. For
example, in this case I would like that simplification process produces
Cos functions rather than Sin functions in order to recognize
similarities with other expressions. In this case, whenever I try to
elaborate an expression such Cos[\[Theta] + \[Alpha]] with \[Alpha]
number strictly greater than \[Pi]/4, it will convert to
Sin[\[Pi]/2-\[Alpha] - \[Theta]], and I want to avoid this.
Anyway, your suggestion is useful, so thank you indeed.

Mauro

Il 18/02/2012 12:32, andres ha scritto:
> So, you don't want Mathematica to evaluate the expression -Cos[\
> [Theta] + (2 \[Pi])/3]?
> Since -Cos[\[Theta] + (2 \[Pi])/3] = Sin[\[Theta] + \[Pi]/6], I assume
> you want to format the output for visualization purposes, because both
> expressions will give the same results. If this is the case, I would
> take two approaches: either apply a Hold to the rhs of the rule, or
> I'd use a rule of the type Sin[\[Theta]_ + \[Pi]/6] :>  -cos[\[Theta] +
> (2 \[Pi])/3], so that the inexistent function "cos" keeps unevaluated.
> If then you want to evaluate the expression you can release the Hold
> or define cos[\[Theta]_] := Cos[\[Theta]].
> Hope it helps.
> Andr=E9s
>
>
>
> On Feb 17, 6:29 am, Mauro<pi...@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
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web