0
$\begingroup$

I have the following python code:

ymin = 1615.72687
ymax = -1607.73011
ec50 = 2.19835099
x,y = symbols('x y')

expression = ((y-ymin)*(ec50+x))+abs(ymax)*x
equation = solve(expression,x)

And it spits out the following equation: [0.5495877475*(-100000.0*y + 161572687.0)/(25000.0*y - 199919.0)]

solve sets expression equal to $0$ and solves for x. When I tried to do this by hand, I received the following answer: $$x = \frac{(y)(ec50) - (ymin)(ec50)}{\mid{ymax}\mid - y -ymin}$$

Hence, I don't see how that equation translates to what was outputted by Python. Also, my assumption for Python multiplying y by $100000.0$ is to compensate for the shift in the other variables. But even taking that into consideration doesn't help me understand the discrepancy between the two equations.

2 Answers 2

0

Your solution for $x$ has some wrong signs in the denominator. The correct solution is:

$$ x = \frac{ec_{50}(-y+y_{min})}{y - y_{min} + |y_{max}|} $$

Substituting the numerical values:

$$ \begin{align} x = \frac{2.19835099\,(-y+1615.72687)}{y - 1615.72687 + 1607.73011} & = \frac{2.19835099\,(-y+1615.72687)}{y -7.99676} \\[5px] & = \frac{\frac{2.19835099}{4}\,(-100000y+161572687)}{25000 y - 199919} \\[5px] \end{align} $$

The latter matches the Python code.

0

your by-hand solution is slightly off. It should be $$x = \frac{y\cdot ec50 - ymin\cdot ec50}{ymin - y -\mid{ymax}\mid}$$.

Taking this into account (and multiplying $y$ by $100000$), the result is correct.

On a side note: The tags you used are way off. This has nothing to do with quadratic forms. And even though it is python code, the relevant thing would be the computer-algebra system you used (probably "sage", or "maxima" or somthing lige that...). Anyway, welcome to stackexchange :)