# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: bmcs_env
#     language: python
#     name: bmcs_env
# ---

import sympy as sp
sp.init_printing()
from cymbol import Cymbol

E_T = Cymbol(r'E_{\mathrm{T}}', codename='E_T_', real=True, nonnegative=True)
S_T = Cymbol(r'S_{\mathrm{T}}', codename='S_T_', real=True, nonnegative=True)
r_T = Cymbol(r'r_{\mathrm{T}}', codename='r_T_', real=True, nonnegative=True)
c_T = Cymbol(r'c_{\mathrm{T}}', codename='c_T_', real=True, nonnegative=True)
E_N = Cymbol(r'E_{\mathrm{N}}', codename='E_N_', real=True, nonnegative=True)
S_N = Cymbol(r'S_{\mathrm{N}}', codename='S_N_', real=True, nonnegative=True)
r_N = Cymbol(r'r_{\mathrm{N}}', codename='r_N_', real=True, nonnegative=True)
c_N = Cymbol(r'c_{\mathrm{N}}', codename='c_N_', real=True, nonnegative=True)
eta = Cymbol(r'\eta', codename='eta_', real=True, nonnegative=True)
r = Cymbol(r'r', codename='r_', real=True, nonnegative=True)

omega_T = Cymbol(r'\omega_{\mathrm{T}}', codename='omega_T_', real=True, nonnegative=True)
omega_N = Cymbol(r'\omega_{\mathrm{N}}', codename='omega_N_', real=True, nonnegative=True)

Y_T = Cymbol(r'Y_{\mathrm{T}}', codename='Y_T_', real=True, nonnegative=True)
Y_N = Cymbol(r'Y_{\mathrm{N}}', codename='Y_N_', real=True, nonnegative=True)

S_NT = sp.sqrt(S_N*S_T)
c_NT = sp.sqrt(c_N*c_T)

omega_NT = 1 - sp.sqrt((1-omega_N)*(1-omega_T))

phi_N = (1 - omega_N)**c_N * S_N / (r+1) * (Y_N / S_N)**(r+1) 
phi_N

phi_T = (1 - omega_T)**c_T * S_T / (r+1) * (Y_T / S_T)**(r+1) 
phi_T

phi_NT = (1 - omega_NT)**c_NT * S_NT / (r+1) * ((Y_N + Y_T)/(S_NT))**(r+1)
phi_NT

phi = (1 - eta)*(phi_N + phi_T) + eta*phi_NT

dot_omega_N = phi.diff(Y_N)
dot_omega_T = phi.diff(Y_T)

sp.simplify(dot_omega_N.subs(eta, 0))

sp.simplify(dot_omega_T.subs(eta, 0))

sp.simplify(dot_omega_N.subs(eta, 1))

sp.simplify(dot_omega_T.subs(eta, 1))



StarcoderdataJupyterScriptsDedupFiltered