# How to simplify expressions in Mathematica with log and exp in them?

• Mathematica
• Master1022
In summary: You can see this by trying different values of z and seeing where the logarithm cuts the real axis. This discontinuity can be a source of error when using the logarithm in complex contexts.In summary, z is a real or complex number that must be used with care when representing it as a variable in Mathematica because the order of operations may not be preserved when composing Log[z] with other Mathematica functions. If z is real, using PowerExpand[] will ensure that the correct branch cut is used, but if z is complex, using Log[z] may lead to an error.
Master1022
TL;DR Summary
How can I get the expression ## log(exp(z)) ## to return ## z ## in Mathematica?
Hi,

This is a pretty simple question, but I am new to Mathematica so I am not sure if I am missing something obvious.

Question: How do I make the expression ## e^{log(z)} ## return z?

Attempt:

I have used all of the following combinations and all of them return ## e^{log(z)}##. Are there any tips people have? I have seen some people online use some elaborate functions, but I am just looking for a simple(r) solution.

Mathematica:
e^log[z]
E^log[z]
PowerExpand[E^log[z]]
Simplify[PowerExpand[E^log[z]]]

PowerExpand[] works for me. Be sure to capitalize Log , Exp and E !

In[1]:= PowerExpand[Log[Exp[z]]]

Out[1]= z

jedishrfu and Master1022
renormalize said:
PowerExpand[] works for me. Be sure to capitalize Log , Exp and E !

In[1]:= PowerExpand[Log[Exp[z]]]

Out[1]= z
Oh wow, that does work! Many thanks. Do you know of any reason why using an upper case Log[] inside a Solve[] function could lead to an error, but then I changed it to log[] (lower case) and the error went away).

Master1022 said:
Do you know of any reason why using an upper case Log[] inside a Solve[] function could lead to an error, but then I changed it to log[] (lower case) and the error went away).
To answer I'd have to see how you set up your Solve[] statement. Can you share it?

How can I get the expression ##\log(exp(z))## to return z in Mathematica?
Question: How do I make the expression ##e^{\log(z)} return z?

First off, is z a complex number? A variable named z is often used to represent a complex number, so if you use z to represent a real number, that can lead to confusion amongst readers.

Mathematically, ##\log(exp(z))## is always defined and is equal to z, but the opposite order in the composition may not be defined due to ##\log(z)## not being defined. If z is real, log(z) is defined only for z > 0.

If z is complex, the Mathematica documentation says this:
Log[z] has a branch cut discontinuity in the complex z plane running from ##-\infty## to 0.

## 1. How do I simplify expressions with logarithms and exponential functions in Mathematica?

To simplify expressions with log and exp functions in Mathematica, you can use the Simplify function. This function will automatically apply algebraic rules and simplify the expression as much as possible.

## 2. Can I use specific properties of logarithms and exponentials to simplify my expressions in Mathematica?

Yes, you can use specific properties of logarithms and exponentials in Mathematica to simplify expressions. Some commonly used properties include the power rule, product rule, quotient rule, and change of base formula.

## 3. How do I handle complex expressions with both log and exp functions in Mathematica?

If you have complex expressions with both log and exp functions, you can use the FullSimplify function in Mathematica. This function will use more advanced techniques to simplify the expression, such as trigonometric identities and logarithmic properties.

## 4. Can I simplify only a specific part of an expression with log and exp functions in Mathematica?

Yes, you can use the Collect function in Mathematica to simplify a specific part of an expression. This function allows you to specify which terms you want to collect and simplify, while leaving the rest of the expression untouched.

## 5. How do I check if my expression with log and exp functions is fully simplified in Mathematica?

You can use the Simplify or FullSimplify function and check if the output is the same as your original expression. If they are the same, then your expression is fully simplified. Additionally, you can use the LeafCount function to compare the complexity of your original and simplified expressions.

• MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
• Introductory Physics Homework Help
Replies
12
Views
745
• MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
• Quantum Physics
Replies
5
Views
912
• MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
• MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K