# How to solve $a \cdot x^{2} + b \cdot x + c + \exp\left( d \cdot x + e \right) = 0$ for $x$ where $x \in \mathbb{C} \cup \{ \hat{\infty} \}$?

#### General

Question: How to solve $$a \cdot x^{2} + b \cdot x + c + \exp\left( d \cdot x + e \right) = 0$$ for $$x$$ where $$x \in \mathbb{C} \cup \left\{ \hat{\infty} \right\} \wedge \left\{ a,\, b,\, c,\, d,\, e \right\} \in \mathbb{C}$$ (note: here $$e$$ is not euler's constant)?

Backgrund: When I sometimes calculate with ODEs, I sometimes come across equations of this form. So I'm wondering what a general solution to this would look like?

#### My Trys

Since I've often encountered such equations, I've tried a few things accordingly. I'll just name the best (for non-trivial stuff):

##### If $$a = 0$$

\begin{align*} 0 \cdot x^{2} + b \cdot x + c + \exp\left( d \cdot x + e \right) &= 0\\ b \cdot x + c + \exp\left( d \cdot x + e \right) &= 0\\ \exp\left( d \cdot x + e \right) &= -c - x \cdot b\\ \end{align*} \begin{align*} -x \cdot b - c &= \exp\left( e - \frac{c \cdot d}{b} + x \cdot d + \frac{c \cdot d}{b} \right)\\ -x \cdot b - c &= \exp\left( e - \frac{c \cdot d}{b} + x \cdot d + \frac{c \cdot d}{b} \right)\\ -x \cdot b - c &= \exp\left( e - \frac{c \cdot d}{b} \right) \cdot \exp\left( x \cdot d + \frac{c \cdot d}{b} \right)\\ \end{align*} \begin{align*} -x \cdot b \cdot \exp\left( -x \cdot d - \frac{c \cdot d}{b} \right) - c \cdot \exp\left( -x \cdot d - \frac{c \cdot d}{b} \right) &= \exp\left( e - \frac{c \cdot d}{b} \right)\\ -x \cdot d \cdot \exp\left( -x \cdot d - \frac{c \cdot d}{b} \right) - \frac{c \cdot d}{b} \cdot \exp\left( -x \cdot d - \frac{c \cdot d}{b} \right) &= \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right)\\ \left( -x \cdot d - \frac{c \cdot d}{b} \right) \cdot \exp\left( -x \cdot d - \frac{c \cdot d}{b} \right) &= \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right)\\ \end{align*} \begin{align*} -x_{k} \cdot d - \frac{c \cdot d}{b} &= W_{k}\left( \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right) \right)\\ x_{k} + \frac{c}{b} &= -\frac{1}{d} \cdot W_{k}\left( \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right) \right)\\ x_{k} &= -\frac{1}{d} \cdot W_{k}\left( \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right) \right) - \frac{c}{b}\\ \end{align*}

$$\fbox{x_{k} = -\frac{1}{d} \cdot W_{k}\left( \frac{d}{b} \cdot \exp\left( e - \frac{c \cdot d}{b} \right) \right) - \frac{c}{b}}$$

Where $$W_{k}$$ is the Lambert W Function...

##### If $$a \ne 0$$

Completing ... \begin{align*} a \cdot x^{2} + b \cdot x + c + \exp\left( d \cdot x + e \right) &= 0\\ a \cdot x^{2} + b \cdot x + \exp\left( d \cdot x + e \right) &= -c\\ a \cdot x^{2} + b \cdot x + \frac{b^{2}}{4} + \exp\left( d \cdot x + e \right) &= -c + \frac{b^{2}}{4}\\ a \cdot x^{2} + b \cdot x + \frac{b^{2}}{4} + \exp\left( d \cdot x + e \right) &= -c + \frac{b^{2}}{4}\\ x^{2} + \frac{b}{a} \cdot x + \frac{b^{2}}{4 \cdot a^{2}} + \frac{1}{a} \cdot \exp\left( d \cdot x + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}}\\ \left(x + \frac{b}{2 \cdot a} \right)^{2} + \frac{1}{a} \cdot \exp\left( d \cdot x + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}}\\ \end{align*} Fail: I can't think of anything useful to add.

Substitution + Compliting ... \begin{align*} \left(\underbrace{x + \frac{b}{2 \cdot a}}_{= u} \right)^{2} + \frac{1}{a} \cdot \exp\left( d \cdot x + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}}\\ u^{2} + \frac{1}{a} \cdot \exp\left( d \cdot \left( u - \frac{b}{2 \cdot a} \right) + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}}\\ u^{2} + \frac{1}{a} \cdot \exp\left( d \cdot u - \frac{d \cdot b}{2 \cdot a} + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}}\\ \frac{1}{a} \cdot \exp\left( d \cdot u - \frac{d \cdot b}{2 \cdot a} + e \right) &= -\frac{c}{a} + \frac{b^{2}}{4 \cdot a^{2}} - u^{2}\\ \exp\left( d \cdot u - \frac{d \cdot b}{2 \cdot a} + e \right) &= -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2}\\ \exp\left( d \cdot u + f - \frac{d \cdot b}{2 \cdot a} + e - f \right) &= -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2}\\ \exp\left( d \cdot u + f \right) \cdot \exp\left( -\frac{d \cdot b}{2 \cdot a} + e - f \right) &= -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2}\\ \exp\left( -\frac{d \cdot b}{2 \cdot a} + e - f \right) &= \left( -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2} \right) \cdot \exp\left( -d \cdot u - f \right)\\ \end{align*} Fail: Nothing to simplify...

Despair \begin{align*} \exp\left( -\frac{d \cdot b}{2 \cdot a} + e - f \right) &= \left( -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2} \right) \cdot \exp\left( -d \cdot u - f \right)\\ -\frac{d \cdot b}{2 \cdot a} + e - f &= \ln\left( \left( -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2} \right) \cdot \exp\left( -d \cdot u - f \right) \right)\\ -\frac{d \cdot b}{2 \cdot a} + e - f &= \ln\left( -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2} \right) + \ln\left( \exp\left( -d \cdot u - f \right) \right)\\ -\frac{d \cdot b}{2 \cdot a} + e - f &= \ln\left( -c + \frac{b^{2}}{4 \cdot a} - a \cdot u^{2} \right) - d \cdot u - f \\ \end{align*}

So there might be a solution in terms of Wright Lambert W functions...

Single Sum:

We solve: $$a x^2 + b x + c + \exp(d x + e)=0\iff \exp(-dx)\left(x^2+\frac ba x+\frac ca\right)=-\frac{\exp(e)}a$$

From this point on, $$e$$ is euler’s constant:

$$e^{-dx}(x+p)(x+q)=r\mathop\iff^{x=t-p} e^{-d(t-p)}(t-p+p)(t-p+q)=e^{-dt+dp} t(t-p+q)=e^{dp}e^{-dt} t(t-p+q)=r$$

Multiply both sides by $$e^{-dp}$$ and use Lagrange reversion:

$$e^{-dt}t(t-p+q)=re^{-dp}\iff t=\frac{r e^{dt}}{e^{dp}(t+q-p)}=\frac{u e^{dt}}{(t+v)}=\sum_{n=1}^\infty\frac{u^n}{n!}\left.\frac{d^{n-1}}{dw^{n-1}}\left(\frac{e^{dw}}{w+v}\right)\right|_0$$

Using general Leibniz rule:

$$\left.\frac{d^{n-1}}{dw^{n-1}}\left(\frac{e^{dw}}{w+v}\right)\right|_0=\sum_{k=0}^n\binom{n-1}k\left.\frac{d^{n-1-k}e^{dnw}}{w^{n-1-k}}\right|_0\left.\frac{d^k(x+v)^{-n}}{dw^k}\right|_0$$

and sum to get Bessel $$\operatorname K_v(z)$$. Therefore:

$$\boxed{e^{-d t}t(t+v)=u\implies t=\frac1{\sqrt\pi}\sum_{n=1}^\infty\frac{\sqrt{-dvn}(dn)^{n-1}}{n!e^\frac{dvn}2}\left(\frac uv\right)^n\operatorname K_{\frac12-n}\left(-\frac{dvn}2\right)}$$

shown here

$$j$$th Complex Solution:

$$a x^2 + b x + c + \exp(d x + e)=0\iff \exp(-dx)\left(x^2+\frac ba x+\frac ca\right)=\exp(-d x)(x^2+A x+B)=C$$

From this point on, $$e$$ is euler’s constant. Use an $$x=t-\frac A2$$ Tshirnhaus transformation:

$$e^{-d t+\frac{Ad}2}\left(t^2-\frac{A^2}4+B\right)=C\iff e^{-d t} \left(t^2-\frac{A^2}4+B\right)=C e^{-\frac{Ad}2}$$

Solve for $$t$$ and use the complex logarithm where $$j\in\Bbb Z$$:

$$t=-\frac1d\ln\left(\frac{e^{-\frac{Ad}2}C}{t^2-\frac{A^2}4+B}\right)-\frac{2\pi i j}d=r \ln\left(\frac p{t^2-q}\right)+2\pi i jr=2\pi i j r+\sum_{n=1}^\infty \frac{r^n}{n!}\left.\frac{d^{n-1}}{dt^{n-1}}\ln^n\left(\frac p{t^2-q}\right)\right|_{2\pi i j r}$$

Using Stirling S1 and binomial theorem:

$$\frac1{n!}\frac{d^{n-1}}{dt^{n-1}}\ln^n\left(\frac p{t^2-q}\right)\mathop=^{\left|\frac p{t^2-q}-1\right|<1}\sum_{k=n}^\infty\frac{S_k^{(n)}}{k!}\frac{d^{n-1}}{dt^{n-1}}\left(\frac p{t^2-q}-1\right)^k= \sum_{k=n}^\infty \sum_{m=0}^k\frac{S_k^{(n)}}{k!}(-1)^{k-m} p^m\binom k m \frac{d^{n-1}}{dt^{n-1}}((t-\sqrt q)(t+\sqrt q))^{-m}$$

shown here. We evaluate $$\frac{d^{n-1}}{dt^{n-1}}(t^2-q)^{-m}$$ with the Gauss hypergeometric function, expressible with Legendre P for very specific values. Finally, use $$\sum\limits_{n=1}^\infty \sum \limits_{k=n}^\infty a_{k,n}=\sum_ \limits{k=1}^\infty\sum \limits_{n=0}^ka_{k,n}$$:

$$\boxed{e^{-d t}(t^2-q)=p\implies t_j=\frac{2\pi i j}d+\sum_{k=1}^\infty \sum_{n=0}^k\sum_{m=0}^k\frac{S_k^{(n)}\Gamma(m+n-1)(-1)^{n+k+1}p^m r^n}{(k-m)!\Gamma(m)m!\left(\frac{2\pi i j}d+\sqrt q\right)^{n-1}\left(\left(\frac{2\pi j}d\right)^2+q\right)^m}\,_2F_1\left(m,1-n;2-m-n;\frac{4\pi j}{2\pi j+id\sqrt q}-1\right)}$$

where if the indices’ upper bound is $$\infty$$, the sums are interchangeable. As $$j\to\infty$$, the sum converges more gradually.

• I have a question: where does the $\color{Red}{ e^{-d \cdot p}}$ come from in the RHS in $e^{-d \cdot x}\left( x + p \right) \cdot \left( x + q \right) = r \overset{x = t - p}{\Leftrightarrow} e^{-d \cdot t} t \cdot \left( t - p + q \right) = r \cdot {\color{Red}{ e^{-d \cdot p}}}$? That doesn't look right to me because if we multiply both sides by $e^{d \cdot x}$ we get $t \cdot \left( t - p + q \right) = r$ which is not true. May 20, 2023 at 9:00
• @KevinDietrich The steps are $e^{-dx}(x+p)(x+q)=r$. Now take $x=t-p: e^{-d(t-p)}(t-p+p)(t-p+q)=e^{-dt+dp} t(t-p+q)=e^{dp}e^{-dt} t(t-p+q)=r$. From this step, multiply both sides by $e^{-dp}$ to get $e^{-d t}t (t-p+q)=r e^{-d p}$. Does this help? May 20, 2023 at 11:30

$$a \, x^{2} + b \, x + c + \exp\left( d \, x + e \right)=0$$

Let $$x=\frac{t-e}{d}\qquad A=-\frac{a}{d^2}\qquad B=\frac{2 a e-b d}{d^2}\qquad C=-\frac{a e^2}{d^2}+\frac{b e}{d}-c$$ to make $$e^t=A\,t^2+B\,t+C$$

Let $$(r_1,r_2)$$ be the roots of the quadratic $$e^t=A(t-r_1)(t-r_2)\quad \implies \quad e^{-t}=\frac 1 A \frac 1{(t-r_1)(t-r_2)}$$ which is in the form of the generalized Lambert function (have a look at equation $$(4)$$).