2

I have the following equation:

import numpy as np

d = (x - y) / np.log((x - z) / (y - z))

Where I am trying to find x

Is this possible in numpy or other python libraries? In this case, could you please provide sample code of how to do it with this specific problem?

cs95
  • 379,657
  • 97
  • 704
  • 746
HerrSober
  • 91
  • 1
  • 6

1 Answers1

3

I would probably use just sympy and their solver: sympy Library Solver

from sympy import solve, log, exp
from sympy.abc import x,y,z,d

f = (x - y) / log((x - z) / (y - z)) - d

solution = solve(f, x)

And the output is giving me is

[-d*LambertW(-(y - z)*exp(-(y - z)/d)/d) + z]
Albert Alonso
  • 656
  • 1
  • 6
  • 21