Mathematica How to simplify an expression in Mathematica

AI Thread Summary
Mathematica's Simplify and FullSimplify functions may not always yield the expected simplified forms for certain expressions, such as Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2]. Users noted that while FullSimplify employs more aggressive techniques, it can still return complex forms instead of simpler ones. The discussion highlighted the importance of providing assumptions about variables to achieve desired simplifications, particularly when dealing with real numbers. It was also pointed out that different functions like TrigExpand and ExpToTrig can be useful for achieving specific simplifications. Ultimately, some expressions may not simplify easily, indicating the limitations of Mathematica compared to manual calculations.
niko2000
Messages
50
Reaction score
0
Hi,
I have got this expression from Mathematica:
Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2]
I have tried to simplify this expression with Simplify[], but it returns the same result.
I have tried to solve some other expressions and it returned some strange forms.
For example:
I have tried to solve some equation on paper and I've got this:
a*Sqrt[(Cos(x))^2+(Sinh(y))^2]
Then I have tried to solve the same equation with Mathematica and it has returned some long expression containing combinations of double angles.
Does anyone know what to do to get the simplest expression?
Anyway I don't know why Mathematica couldn't simplify an expression as simple as a*Sqrt[(Cos(x))^2+(Sinh(y))^2]
 
Physics news on Phys.org
Have you tried FullSimplify?

If you read the documentation, you'll see FullSimplify does quite a bit more. It has more aggressive factoring, rationalizing, and other techniques that Simplify does not.
 
On Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2] FullSimplify doesn't work. It returns the same expression.
 
Nothing's perfect. :smile:
 
I also found that Mathematica Simplify command doesn't work as we expect.
Your expression looks already simplified...one can make different simplifications according to the expression we want to reach, mathematica also gives one possibility.If your expression contains only terms, which doesn't contain any Sin or Cos or some other functions, Mathematica is okay...Mathematica 5.0 has more advanced features..have a look at it..
 
manesh said:
I also found that Mathematica Simplify command doesn't work as we expect.
Your expression looks already simplified...one can make different simplifications according to the expression we want to reach, mathematica also gives one possibility.If your expression contains only terms, which doesn't contain any Sin or Cos or some other functions, Mathematica is okay...Mathematica 5.0 has more advanced features..have a look at it..

That's why I always try FullSimplify.

If you read the release notes, you'll see that 99% of the modifications from 4.0 to 5.0 deal with performance enhancements (specifically linear algebra functions). I've been unable to find any enhancements to FullSimplify and Simplify other than performance.
 
exactly u r right..
 
Remember:

<br /> \[<br /> \sqrt {a^2 } \ne a<br /> \]<br />

And it won't do this invalid operation.

Best
 
What is true if that's not true?
 
  • #10
<br /> \[<br /> \sqrt {a^2 } = \pm a<br /> \]<br />​
If you want to ignore the negative root you have to explicitly indicate this.
Simplify[Sqrt[a^2]] just yields √a2
but
Simplify[Sqrt[a^2], a>=0] simplifies to a
Why are you expecting
a*Sqrt[(Cos[x])^2 + (Sinh[y])^2]

to simplify?

Just to make sure the obvious is covered: you have noticed that Sinh is shown rather than Sin? And also that Cos is applied to x while Sinh is applied to y?

Have you checked out the hints in the online documentation on getting Simplify to do what you want? Have you looked at related functions like TrigExpand and ExpToTrig?
 
  • #11
a*Sqrt[(Cos[x])^2+(Sinh[y])^2] is what I've got on paper and that is not related to the first problem.
The first problem was that mathematica couldn't simplify this:
Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2]
 
  • #12
plover said:
<br /> \[<br /> \sqrt {a^2 } = \pm a<br /> \]<br />​
If you want to ignore the negative root you have to explicitly indicate this.
Simplify[Sqrt[a^2]] just yields √a2
but
Simplify[Sqrt[a^2], a>=0] simplifies to a
Why are you expecting
a*Sqrt[(Cos[x])^2 + (Sinh[y])^2]

to simplify?

Just to make sure the obvious is covered: you have noticed that Sinh is shown rather than Sin? And also that Cos is applied to x while Sinh is applied to y?

Have you checked out the hints in the online documentation on getting Simplify to do what you want? Have you looked at related functions like TrigExpand and ExpToTrig?


I was under the impression that FullSimplify calls TrigExpand and ExpToTrig for a maximum simplification effect.
 
  • #13
graphic7 said:
I was under the impression that FullSimplify calls TrigExpand and ExpToTrig for a maximum simplification effect.
I'm no expert, I was just offering suggestions of things to look at. However, when used on the expression:
a*Sqrt[(Cos[x])^2 + (Sinh[y])^2]

both Simplify[] and FullSimplify[] alone do nothing, while Simplify[TrigToExp[]], ExpToTrig[Simplify[TrigToExp[]]], and FullSimplify[TrigToExp[]] all produce different answers (though the last two are similar). I'm using version 4.1.
 
  • #14
niko2000 said:
a*Sqrt[(Cos[x])^2+(Sinh[y])^2] is what I've got on paper and that is not related to the first problem.
Yes, I understand this. But you also said:
Anyway I don't know why Mathematica couldn't simplify an expression as simple as a*Sqrt[(Cos(x))^2+(Sinh(y))^2]
It seems you think this expression should simplify, and that the reason it should simplify is obvious. Since I don't see any good way to simplify this and neither does Mathematica, I'm wondering why you think it simplifies, and what you would simplify it to.

At the moment, I see two possibilities, either a) your expectation is incorrect, or b) I am not understanding your expectation.
The first problem was that mathematica couldn't simplify this:
Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2]
Again, I'm not sure why you think this should simplify. What form did you want it to be in? There are many functions for transforming expressions in Mathematica other thanSimplify[].
 
  • #15
We were calculating Lame's coeficients for some coordinate system.
We had these data:
x=a*Cosh*Sin[P]*Cos[F]
y=a*Cosh*Sin[P]*Sin[F]
z=a*Sinh*Cos[P]

The first coeficient (let's call it f1):
f1=Sqrt[(dx/dB)^2+(dy/dB)^2+(dz/dB)^2]
The second:
f2=Sqrt[(dx/dP)^2+(dy/dP)^2+(dz/dP)^2]
The third:
Sqrt[(dx/dF)^2+(dy/dF)^2+(dz/dF)^2]

After our calculations we've got this:
f1=f2=a*Sqrt[Cos[P]^2+sinh^2]
f2=a*Cosh*Sin[P]

When I tried to get these results with Mathematica I have got much more complex results.
Instead of giving the results in the same form it gave for f1 and f2 some combination of double angles and f3 Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2]
 
  • #16
For f3 you need to give assumptions in order to simplify. Do you have constraints for the values of a, B, and P?

The most obvious assumption to provide is that a, B, and P are real numbers.
Simplify[f3, Element[{a,B,P},Reals]]
yields
Abs[a] Abs[Sin[P]] Cosh
This seems reasonable.

If you can also say that a>=0 and 0<=P<=Pi then you can simplify to the form you gave:
Simplify[f3, Element[{a,B,P},Reals] && (a>=0) && (0<=P<=Pi)]
yields
a Sin[P] Cosh

Unfortunately, I can't see any easy way to get Mathematica to simplify to the form you give for f1 and f2 rather than the double angle form. I'm not enough of an expert to be sure that none actually exists though. But, this may just be one of those things for which the human brain is still the best tool.
 

Similar threads

Replies
5
Views
3K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
13
Views
2K
Replies
19
Views
2K
Replies
1
Views
2K
Back
Top