3

I have a syntax problem solving a differential equation in Mathematica (10th version).

The input for the equation I need to solve is as follows:

solv = DSolve[{ a*u''[y] - b*u[y] == d, u'[0] == 0, u[1] == 0}, u, {y, -1, 1}]

Which after using ExpToTrig and FullSimplify I get the answer I am looking for:

(d (-1 + Cosh[(Sqrt[b] y)/Sqrt[a]] Sech[Sqrt[b]/Sqrt[a]]))/b

However, my problem comes when I want to place more coefficients in the equation. For example:

solv = DSolve[{ a* u''[y] - b* c* u[y] == d, u'[0] == 0, u[1] == 0}, u, {y, -1, 1}]

This time, I get for:

FullSimplify[ExpToTrig[Evaluate[u[y] /. solv]]]

The next answer:

(d (1 + E^((2 Sqrt[b] Sqrt[c])/Sqrt[a]) - E^(-((Sqrt[b] Sqrt[c] (-1 + y))/Sqrt[a])) - E^((Sqrt[b] Sqrt[c] (1 + y))/Sqrt[a])) (-1 + Tanh[(Sqrt[b] Sqrt[c])/Sqrt[a]]))/(2 b c)

Instead, when I merge b and c (substitute: bc=b*c):

solv = DSolve[{ a*u''[y] - bc*u[y] == d, u'[0] == 0, u[1] == 0}, u, {y, -1, 1}]

I get:

(d (-1 + Cosh[(Sqrt[bc] y)/Sqrt[a]] Sech[Sqrt[bc]/Sqrt[a]]))/bc

In my case I can't just substitute because there are too many equations and some of the parameters (coefficients) cancel.

Thanks!

dfel
  • 31
  • 1
  • Your question would probably get more attention at [mathematica.se] –  Jul 21 '15 at 01:28
  • If you put your code on Dropbox or some other service where people don't have to register, sign in, send photo id, etc, etc, and you clearly show in that code one example and explain precisely what you want done and why it isn't working and if that was solved by someone then it would almost certainly solve all your other problems... then someone might be able to grab the code, try a fix, verify it works and post an answer here. If someone gave you a question: "sort of like this except much bigger and doesn't work" then it would be very hard for you to know how to answer that. – Bill Jul 21 '15 at 17:40

1 Answers1

0

Your issue is with FullSimplify. It deems the exp form more "simple" than the trig form so it is undoing what ExpToTrig is doing. Using just Simplify in its place will maintain the ExpToTrig conversion. My quick try below shows a comparison.

mathematica demo

pragmatist1
  • 919
  • 6
  • 16