```python
import numpy as np
import sympy as sym
from sympy.utilities.lambdify import lambdify
import matplotlib as mpl
import numpy as np
```


```python
sym.init_printing(use_unicode=True)
%matplotlib inline
mpl.style.use('seaborn-talk')
```


```python
x, t, z, = sym.symbols('x t z', real=True)
psi, phi,theta, pi, omega = sym.symbols('psi, phi theta, pi, omega', real=True)
alph1, alph2 = sym.symbols('\\alpha(\\theta), \\alpha(\\theta-1)', real=True)

c, rho, delta = sym.symbols('c, rho, delta', real=True, positive=True)
```


```python
alph1
```


```python
a = rho * x - rho * c * x**2
```


```python
a
```


```python
b = c * delta  * x + c**2 * omega * x**2
```


```python
alpha = psi * x - (1 - phi**2) * ( x**2 / 2)
```


```python
tmp = alpha.replace(x, -1)
```


```python
tmp
```


```python
b.replace(x, tmp + pi + alpha.replace(x, theta)).replace
```


```python
a.replace(x, tmp + pi + alpha.replace(x, theta))
```


```python
beta = alpha.replace(psi, psi - (1 - phi**2) / 2).replace(x, psi - (1 - phi**2))
```


```python
beta
```


```python
psi = sym.solveset(psi * rho + beta + 2 * psi**2 * c, psi)
```


```python
psi.replace(phi, 0)
```


```python
psi.replace(c,1)
```


```python
psi.replace(phi, 1).replace(c,1)
```


```python
psi.replace(rho, 0).replace(c,1)
```


```python
psi.replace(phi, 0).replace(c,1)
```


```python
psi_with_num = psi.replace(rho,.9).replace(c,1)
```


```python
psi0_func = lambdify(phi, psi_with_num.args[0])
psi1_func = lambdify(phi, psi_with_num.args[1])
```


```python
fig1, ax1 = mpl.pyplot.subplots()
xvals = np.linspace(-1,1,100)
yvals = [psi0_func(x) for x in xvals]
ax1.plot(xvals, yvals)
```


```python
fig2, ax2 = mpl.pyplot.subplots()
xvals = np.linspace(-1,1,100)
yvals = [psi1_func(x) for x in xvals]
ax2.plot(xvals, yvals)
```


```python
b
```


```python
psi
```


```python
gamma = b.replace(x, -x + ( 1- phi**2))
```


```python
psi2 = sym.solveset(x * rho + gamma + x**2 * c**2 * omega / 2, x)
```


```python
psi2.replace(c,1)
```


```python

```

16c3354dac7df09b8d831c03d91efe380fca09e4
ipynb
Jupyter Notebook
volpriceinference/simplification_of_physical_measure_functions.ipynb
sangrey/RiskPriceInference
9ec8b235e3d1f24281890a5f689840affd3f495e
Apache-2.0
volpriceinference/simplification_of_physical_measure_functions.ipynb
sangrey/RiskPriceInference
9ec8b235e3d1f24281890a5f689840affd3f495e
Apache-2.0
volpriceinference/simplification_of_physical_measure_functions.ipynb
sangrey/RiskPriceInference
9ec8b235e3d1f24281890a5f689840affd3f495e
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES