How to simplify an expression in Mathematica

In summary, the person is trying to figure out why an expression that looks simple on paper, is not simplifying in Mathematica. They have tried different simplification techniques with no success. They have also tried other functions like trigexpand and expto trig and found that they don't have the same success.
  • #1
niko2000
51
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
  • #2
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.
 
  • #3
On Sqrt[a^2*(Cosh(x))^2*(Sin(y))^2] FullSimplify doesn't work. It returns the same expression.
 
  • #4
Nothing's perfect. :smile:
 
  • #5
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..
 
  • #6
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.
 
  • #7
exactly u r right..
 
  • #8
Remember:

[itex]
\[
\sqrt {a^2 } \ne a
\]
[/itex]

And it won't do this invalid operation.

Best
 
  • #9
What is true if that's not true?
 
  • #10
[itex]
\[
\sqrt {a^2 } = \pm a
\]
[/itex]​
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:
[itex]
\[
\sqrt {a^2 } = \pm a
\]
[/itex]​
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.
 

1. How do I simplify an expression in Mathematica?

To simplify an expression in Mathematica, you can use the Simplify function, which attempts to reduce an expression to its simplest form by applying mathematical transformations. For example, if you have the expression (x + x^2)/(x + 1), you can use Simplify[(x + x^2)/(x + 1)] to get the simplified form of x.

2. Can I specify certain simplification rules for Mathematica to follow?

Yes, you can use the Simplify function with an optional second argument that specifies a list of assumptions and transformation rules for Mathematica to use when simplifying an expression. For example, you can use Simplify[x^2 + x^3, x > 0] to assume that x is a positive number.

3. How does Mathematica handle complex expressions?

Mathematica has built-in functions for handling complex numbers and expressions. When simplifying a complex expression, Mathematica will use its internal algorithms to simplify the expression as much as possible, taking into account complex numbers and their properties.

4. Can I simplify only a part of an expression in Mathematica?

Yes, you can use the function Simplify with the option ExcludedForms to specify parts of an expression that should not be simplified. For example, Simplify[x^2 + x^3, x > 0, ExcludedForms -> x^3] will only simplify the x^2 term and leave the x^3 term unchanged.

5. How can I check if an expression is already in its simplest form?

You can use the function FullSimplify to check if an expression is already in its simplest form. FullSimplify will apply all possible simplification rules to an expression and return the fully simplified form. If the returned expression is the same as the original, it means that the expression is already in its simplest form.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
119
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
248
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top