# Methodology to Solve a Riccati Equation

I am new to solving ODEs and need some help. I have the following SDE:

$\frac{d \eta_t}{dt} = \sigma_\mu^2 - 2 \lambda \eta_t - \sigma^{-2} \eta_t^2$

$\sigma_\mu$, $\lambda$, $\sigma$ are deterministic. The boarder condition is :

$\eta_{\tau}=\frac{\overline \eta \nu^2}{\overline \eta^2 + \nu^2 }$

$\bar{\eta}$ and $\nu$ are also both deterministic. $t \ge \tau$

When I solve the SDE in Mathematica, I get the following:

$\eta\to \text{Function}\left[\{t\},-\lambda \sigma^2+\sigma \sqrt{\sigma_\mu^2+\lambda^2 \sigma^2} \text{Tanh}\left[\frac{\sqrt{\sigma_\mu^2+\lambda^2 \sigma^2} t}{\sigma}-\sigma \sqrt{\sigma_\mu^2+\lambda^2 \sigma^2} C[1]\right]\right]$

Is this correct?

Also, are the steps to solve this ODE complex? Quite frankly, I am not too sure how to tackle this.

My Mathematica input was:

eqn = n'[t] == m^2 - 2*l*n[t] - s^(-2)*n[t]^2;

RightHandSideCoeffs = {m^2, 2*l, -s^(-2)};

Total[RightHandSideCoeffs] sol = DSolve[eqn, n, t]

You can solve it directly since it is separable, asuming that $$\sigma_\mu, \lambda$$ and $$\sigma$$ are constants. Dividing both sides by your RHS and integrating over $$t$$, we have that $$\int \frac{\frac{\mathrm{d}\eta_t}{\mathrm{d}t}}{\sigma_\mu^2 - 2 \lambda \eta_t - \sigma^{-2} \eta_t^2} \mathrm{d}t = \int \mathrm{d}t = t + c_1.$$
The LHS integral can be rearranged in order to obtain an hyperbolic arctangent. Notice that $$\sigma_\mu^2 - 2 \lambda \eta_t - \sigma^{-2} \eta_t^2 = \sigma_\mu^2 + \lambda^2\sigma^2 - \left(\frac{\eta_t}{\sigma} + \lambda\sigma\right)^2 = \left(\sigma_\mu^2 + \lambda^2\sigma^2\right)\left[1 - \left(\frac{\eta_t + \lambda\sigma^2}{\sigma\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}}\right)^2\right],$$ so \begin{aligned} t + c_1 &= \frac{\sigma}{\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}} \int \frac{\frac{1}{\sigma\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}}\frac{\mathrm{d}\eta_t}{\mathrm{d}t}}{\left[1 - \left(\frac{\eta_t + \lambda\sigma^2}{\sigma\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}}\right)^2\right]} \mathrm{d}t = \frac{\sigma}{\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}} \tanh^{-1}\left(\frac{\eta_t + \lambda\sigma^2}{\sigma\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}}\right) \\ &\Rightarrow \boxed{\eta_t(t) = \sigma\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2}\tanh\left(\frac{\sqrt{\sigma_\mu^2 + \lambda^2\sigma^2} (t+c_1)}{\sigma}\right) -\lambda\sigma^2.} \end{aligned}