I have been trying this problems for hours and cannot find any helpful clues.

How can I convert $Sinh[3\theta]+Sinh[\theta]$ to a rational function of x given $2Sinh[\theta] = x-x^{-1}$ by using only a SINGLE pattern replacement rule. I guess what single means is that we are only allowed to use one arrow.

My question is twofold:
1. I have one method but unsure of its correctness, also although I know the method but I am unable to write the code.
2. If my method is wrong, what is the correct one? This is the best method that I can think of.

My method is as follows:
Since we have the hyperbolic trig formula, we can use the rule (I will use Q instead)

Sinh[a Q] -> (x^a - x^-a)/2

I have tried many ways, and below are the 2 best ones that I think are the closest to the correct answers:

In: f := {Sinh[a Q] + Sinh[Q]} /. Sinh[a Q] -> (x^a - x^-a)/2;
In: {Sinh[3 Q]] + Sinh[Q]} // f  

Out: {1/2 (-x^-a + x^a) + Sinh[Q]}[{Sinh[Q] + Sinh[3 Q]}]

In: {Sinh[#1 Q] + Sinh[#2 Q]} /. Sinh[# Q] -> (x^# - x^-#)/2 &[3, 1]  

Out: {1/2 (-(1/x^3) + x^3) + Sinh[Q]]}

I always have troubles putting the rules into one entity such that it will replace every coefficient of Q, including 1. The output that I am looking for (using my method) is

Sinh[3Q] + Sinh[Q] = x^3 - x^-3 + x - x^-1  

Many thanks.

  • 1
    $\begingroup$ Would TrigToExp[Sinh[3 Q] + Sinh[Q]] /. Exp[a_. Q] -> 2 x^a work ? $\endgroup$ – b.gates.you.know.what May 18 '13 at 13:18
  • 2
    $\begingroup$ From your sentence " I guess what single means is that we are only allowed to use one arrow." I infer this is homework. Am I right? $\endgroup$ – Dr. belisarius May 18 '13 at 15:05
  • $\begingroup$ You might find Alternatives to be useful. $\endgroup$ – whuber May 18 '13 at 15:20
  • $\begingroup$ @b.gatessucks Thanks! yes your method works. I have never used TrigToExp before, but I have learned new things now. $\endgroup$ – user71346 May 19 '13 at 1:46
  • $\begingroup$ @belisarius Yes, this is an exercise. $\endgroup$ – user71346 May 19 '13 at 1:47

Using defaults values _. (for multiplication it is 1) works:

{Sinh[3 Q] + Sinh[Q]} /. Sinh[a_. Q] -> (x^a - x^-a)/2
  • 1
    $\begingroup$ You should probably use :> to localize a $\endgroup$ – Simon Woods May 18 '13 at 21:27
  • $\begingroup$ Great! Thanks so much Andrew. This is the first time I learn about defaults values. It is really helpful! $\endgroup$ – user71346 May 19 '13 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.