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

AI Thread Summary
The discussion centers on how to simplify the expression e^(log(z)) in Mathematica to return z. The user initially tries various combinations, including e^log[z] and PowerExpand[E^log[z]], but only receives e^(log(z)) as a result. A solution is found using PowerExpand with the correct capitalization of Log, Exp, and E, which successfully simplifies Log[Exp[z]] to z. The conversation also touches on potential issues with using uppercase Log in a Solve function, where switching to lowercase log resolves an error. It is noted that the variable z can represent either a complex or real number, which may affect the definition of log(z). For real numbers, log(z) is only defined for z > 0, while for complex numbers, log(z) has branch cut discontinuities, complicating its use in certain contexts.
Master1022
Messages
590
Reaction score
116
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.

[CODE title="Mathematica"]e^log[z]
E^log[z]
PowerExpand[E^log[z]]
Simplify[PowerExpand[E^log[z]]][/CODE]

Thanks in advance.
 
Physics news on Phys.org
PowerExpand[] works for me. Be sure to capitalize Log , Exp and E !

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

Out[1]= z
 
  • Like
  • Wow
Likes 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?
 
@Master1022, in your first post you asked two different questions:
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.
 

Similar threads

Replies
4
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
6
Views
3K
Replies
4
Views
2K
Replies
1
Views
2K
Back
Top