Ask Your Question

Jorge's profile - activity

2020-10-13 05:53:36 +0200 received badge  Notable Question (source)
2018-04-04 16:42:23 +0200 received badge  Famous Question (source)
2018-02-11 15:29:12 +0200 received badge  Notable Question (source)
2017-11-22 09:37:42 +0200 received badge  Popular Question (source)
2017-05-28 05:31:51 +0200 received badge  Notable Question (source)
2016-12-18 04:49:01 +0200 received badge  Popular Question (source)
2016-04-23 12:04:49 +0200 received badge  Famous Question (source)
2016-01-06 03:52:59 +0200 received badge  Notable Question (source)
2015-06-22 16:14:27 +0200 received badge  Popular Question (source)
2015-05-24 00:31:48 +0200 received badge  Popular Question (source)
2014-12-11 21:22:32 +0200 asked a question 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?

2014-10-14 01:38:25 +0200 received badge  Supporter (source)
2014-10-13 16:48:11 +0200 received badge  Student (source)
2014-10-12 05:08:48 +0200 commented answer Two Y-axes

I'm trying to mimic your solution for this: phi = var('phi') a=2 q1=a*phi^2+1 q2=a*phi^2+2000 t1=q1.plot(aspect_ratio=1,xmin=0,xmax=10) t2=q2.plot(aspect_ratio=1,xmin=0,xmax=10) z=t1+t2 z.show(xmin=0,xmax=10,ymin=0,ymax=300,aspect_ratio=.02) But I had no success. Do you know how I should proceed?

2014-10-12 02:46:38 +0200 asked a question How to make two plots on a different scale

I have two plots that I need to represent on the same graph. Here is a mwe. I can scale q2 down, but ideally I would like to have a y-axis on the left representing q1 values and another y-axis on the right representing q2 values. How can I do that?

phi = var('phi')
a=2
q1=a*phi^2+1
q2=a*phi^2+2000
t1=q1.plot(aspect_ratio=1,xmin=0,xmax=10)
t2=q2.plot(aspect_ratio=1,xmin=0,xmax=10)
z=t1+t2
z.show(xmin=0,xmax=10,ymin=0,ymax=300,aspect_ratio=.02)
2014-10-11 01:32:32 +0200 asked a question How to save graphics into an image in sagemath online?

I am running sage cloud with a windows computer and I want to save graphics into an image. I found the following documentation:

sage: c = circle((1,1), 1, color='red')
sage: filename = os.path.join(SAGE_TMP, 'test.png')
sage: c.save(filename, xmin=-1, xmax=3, ymin=-1, ymax=3)

However it save nothing on my system or on the online folder. I suspect that this works when you have sagemath installed on the computer. How can I save on my system or on the online folder?

2014-08-04 06:31:14 +0200 commented answer Finding numerical solution to a nonlinear equation

By plotting the function, I noticed that there would be 2 roots. Unfortunately, find_root cannot obtain them at once. But following your suggestion did the trick.

2014-08-04 06:27:04 +0200 received badge  Scholar (source)
2014-08-03 06:39:57 +0200 asked a question Finding numerical solution to a nonlinear equation

I'm trying to find a solution for a nonlinear equation using cloud.sagemath but I have been unsuccessful. The command "solve" could not find a result, and I haven't been able to input the range over which the solution should be looked. Here is my code:

phi = var('phi')
a = .25
beta = 1
g = .2
ce = .5
alpha = .1
gamma = 2
V = .5
rho = .8
sigma = 4
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
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)
y = q*N
phi1 = alpha/(1-alpha)
eq = beta*ce^(-1)-alpha*kappa^(-1)*N == 0
phi2 = solve(eq,phi)
print phi2

I get

[
phi == -1/11*e^(12*phi - 8) - 2/11*e^(6*phi - 4) + 4/11
]

Can someone help? And how can I ask for a solution on $[0,1]$?

2013-05-24 02:38:15 +0200 received badge  Editor (source)
2013-05-23 23:34:39 +0200 asked a question How to config texmaker to run sage

I just installed Sage 5.9 on a computer running Windows (VirtualBox). But could not make it run with Texmaker.

I'm trying to run the "Examples of embedding Sage in LaTeX...", so I presume that the LaTeX code is correct. The problem must be in the communication between Texmaker and Sage operating on VirtualBox.

So how can I make Texmaker call Sage on the shell? Is there a way to integrate them?

Jorge