Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Having trouble inverting a simple math equation using logarithms in Python

After trying to reverse a very simple math formula for the past day, I’ve given up after bumping my head against scipy.special.lambertw — which might not even be the correct place to be looking.

I have the following equation:

import numpy

# The following == 70.03
np.sqrt(np.log(742) * 742)

I’m trying to invert that equation — where inputing 70.03 would equal 742.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Here was my current attempt after playing around with an algebra solver and Wolfram Alpha:

from scipy.special import lambertw

np.power(np.power(np.e, lambertw(70.03)), 2)

This obviously produces an incorrect answer — but since algebra was so long ago, I’m basically lost as to how to produce a function that coverts 70.03 back into 742.

Thanks for any help!

>Solution :

From WolframAlpha I get

from scipy.special import lambertw

f = lambda x: x ** 2 / lambertw(x ** 2)

as the inverse.

indeed

f(70.03) gives (742.008379366021+0j)

but i dont have the mathematics to find what wolframalpha found, i hope you understand why f above is the inverse really

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading