Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Evaluating a symbolic expression

I am trying to evaluate a symbolical expression, but I don't know to ask Sage to compute the final expression:

phi = var('phi')

a=.25
beta=1
g=.2
ce=.5
alpha=.1
gamma=10
V=.5
rho=.9
sigma=2
sigmaeps=1
K=2
R=2 
K2=2 

avginv=K+R+K2
Sinv=phi*avginv
Swinv=K2+R-Sinv
psinv=(-1+(1+4*rho^(-2)*sigma^(-2)*K)^(1/2))/(2*rho^(-2)*sigma^(-2))

phipriv=K/avginv
phipub=Swinv/avginv
phimax=1-phipriv
phimin=alpha/(1+alpha)

prob=a-a*e^(-Swinv)
kappa=gamma*prob*(1-prob)*g^2

N=beta^(-1)*(1+alpha)*phi - beta^(-1)*alpha

L=beta^(-2)*(V+(1-phipriv)*avginv^(-1)+sigmaeps - 2*sigmaeps*phi + rho^2*sigma^2*psinv^(-2)*phipriv^2)
q=(beta*ce^(-1)-alpha*kappa^(-1)*N)*(gamma*L + ce^(-1)+kappa^(-1)*N^2)^(-1)
qN=q*N
kg=prob*g

t=-rho^(-1)+(gamma/2)*q^2*beta^(-2)
t2=t(phi=1/3)
print t2


sage: 5.00000000000000*(-0.666666666666667/((0.250000000000000*e^(-2) + 0.750000000000000)*(-2.50000000000000*e^(-2) + 2.50000000000000)) + 2.00000000000000)^2/(-1.77777777777778/((0.250000000000000*e^(-2) + 0.750000000000000)*(-2.50000000000000*e^(-2) + 2.50000000000000)) - 13.2881527307120)^2 - 1.11111111111111

Why Sage hasn't computed the final expression?