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

Click For Summary

Discussion Overview

The discussion revolves around simplifying expressions in Mathematica that involve logarithmic and exponential functions, specifically focusing on how to manipulate expressions like ## e^{\log(z)} ## and ## \log(\exp(z)) ## to return the variable z. The scope includes practical usage of Mathematica functions and potential issues with capitalization in function names.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses uncertainty about how to simplify the expression ## e^{\log(z)} ## in Mathematica, having tried various functions without success.
  • Another participant suggests using the solve() function as a potential solution.
  • PowerExpand is mentioned by multiple participants as a method that works for simplifying expressions, provided that the functions Log, Exp, and E are capitalized.
  • A participant notes that using lowercase log in a Solve function resolved an error, prompting a question about the setup of the Solve statement.
  • There is a clarification regarding the mathematical definitions of log and exp, particularly the conditions under which log(z) is defined, depending on whether z is real or complex.

Areas of Agreement / Disagreement

Participants generally agree on the utility of PowerExpand for simplification, but there is no consensus on the best approach to handle potential errors related to capitalization or the definitions of log and exp for different types of numbers.

Contextual Notes

There are limitations regarding the definitions of logarithmic functions, particularly concerning their domains and branch cuts in the complex plane, which may affect the simplification process.

Master1022
Messages
590
Reaction score
116
TL;DR
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   Reactions: 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
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K