L

#### longlifelearner

##### Guest

Here are the equations written in Python:

Code:

```
import numpy as np
from scipy.optimize import fsolve
C_p = 10
P_0 = 110
C_op = 2.7
gamma = 0.03
delta = 0.1
C_h = 0.25
C_d = 17
theta = 0.1
a = 100
p = 15
b = 0.5
c = 0.25
C_s = 50
l = theta + gamma - c * (delta - 1)
mu = P_0 + a * pow(p,-b) * (delta - 1)
K_1 = (a * pow(p,-b) * delta) + ((mu/l) * ((c * delta) - gamma))
K_2 = (mu/(l*l)) * (gamma - c * delta)
def aux_1(x):
return (C_h + C_d * theta) * (((mu/l) * (1 - np.exp(-l * x[0]))) - ((a*pow(p,-b)/(theta + c)) * (np.exp((theta + c)*(x[1]-x[0])) - 1)))
def aux_2(x):
return ((a*pow(p,-b)/(theta + c)) * ((x[1] - 1/(theta + c))*(np.exp((theta + c) * (x[1] - x[0]))-1) + (x[1] - x[0]))) - ((mu/l) * (x[0] + ((np.exp(-l*x[0])-1)/l)))
#System of differential equations
def func(x):
return [C_p * P_0 + C_op * (x[0] + l * K_2 * np.exp(-l * x[0])) + aux_1(x),
((C_h + C_d * theta) * aux_2(x)) - C_s - (C_p * P_0 * x[0]) - (C_op * ((K_1 * x[0]) - (K_2 * (np.exp(-l*x[0])-1))))]
root = fsolve(func, [0,0], maxfev=10000)
#Optimal root values
print(root)
```

This is my reference paper: enter image description here

I want the code in Python format so I can explain the "Numerical examples" section.

<p>I am trying to solve a system of non-linear equations. The issue is that the output generated by the Python code is different from the output in my reference paper. In my reference paper, the optimal values are [0.2372, 0.9145] when using Lingo, whereas when I tried it in Python, the output was different.</p>

<p>Here are the equations written in Python:</p>

<pre class="lang-py prettyprint-override"><code>import numpy as np

from scipy.optimize import fsolve

C_p = 10

P_0 = 110

C_op = 2.7

gamma = 0.03

delta = 0.1

C_h = 0.25

C_d = 17

theta = 0.1

a = 100

p = 15

b = 0.5

c = 0.25

C_s = 50

l = theta + gamma - c * (delta - 1)

mu = P_0 + a * pow(p,-b) * (delta - 1)

K_1 = (a * pow(p,-b) * delta) + ((mu/l) * ((c * delta) - gamma))

K_2 = (mu/(l*l)) * (gamma - c * delta)

def aux_1(x):

return (C_h + C_d * theta) * (((mu/l) * (1 - np.exp(-l * x[0]))) - ((a*pow(p,-b)/(theta + c)) * (np.exp((theta + c)*(x[1]-x[0])) - 1)))

def aux_2(x):

return ((a*pow(p,-b)/(theta + c)) * ((x[1] - 1/(theta + c))*(np.exp((theta + c) * (x[1] - x[0]))-1) + (x[1] - x[0]))) - ((mu/l) * (x[0] + ((np.exp(-l*x[0])-1)/l)))

#System of differential equations

def func(x):

return [C_p * P_0 + C_op * (x[0] + l * K_2 * np.exp(-l * x[0])) + aux_1(x),

((C_h + C_d * theta) * aux_2(x)) - C_s - (C_p * P_0 * x[0]) - (C_op * ((K_1 * x[0]) - (K_2 * (np.exp(-l*x[0])-1))))]

root = fsolve(func, [0,0], maxfev=10000)

#Optimal root values

print(root)

</code></pre>

<p>This is my reference paper: <a href="https://i.sstatic.net/WiaOY0Qw.png" rel="nofollow noreferrer">enter image description here</a></p>

<p>I want the code in Python format so I can explain the "Numerical examples" section.</p>