1 | initial version |
Regarding 1., it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that.
Regarding 2, you can use the solution_dict=True
of solve :
sage: z=solve([L_x==0, L_y==0, L_l==0,], x, y, l, solution_dict=True)
sage: z
[{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}]
sage: z[0]
{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}
sage: z[0][x]
R*alpha/((alpha + beta)*p_x)
sage: z[0][y]
R*beta/((alpha + beta)*p_y)
2 | No.2 Revision |
Regarding 1., it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that.
Regarding 2, you can use the solution_dict=True
of solve :
sage: z=solve([L_x==0, L_y==0, L_l==0,], x, y, l, solution_dict=True)
sage: z
[{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}]
sage: z[0]
{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}
sage: z[0][x]
R*alpha/((alpha + beta)*p_x)
sage: z[0][y]
R*beta/((alpha + beta)*p_y)
3 | No.3 Revision |
Regarding 1., it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that.
Regarding 2, you can use the solution_dict=True
of solve :
sage: z=solve([L_x==0, L_y==0, L_l==0,], x, y, l, solution_dict=True)
sage: z
[{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}]
sage: z[0]
{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}
sage: z[0][x]
R*alpha/((alpha + beta)*p_x)
sage: z[0][y]
R*beta/((alpha + beta)*p_y)
You can pass a dictionary for substituting:
sage: U.subs(z[0]) A(Ralpha/((alpha + beta)p_x))^alpha(Rbeta/((alpha + beta)p_y))^beta
4 | No.4 Revision |
Regarding 1., it is not possible to use unicode λ in variables names, since Sage relies on Python 2, which does not allow it, so you have to wait the migration of Sage to Python 3 for that.
Regarding 2, you can use the solution_dict=True
of solve :
sage: z=solve([L_x==0, L_y==0, L_l==0,], x, y, l, solution_dict=True)
sage: z
[{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}]
sage: z[0]
{l: (A*alpha + A*beta)*(R*alpha/((alpha + beta)*p_x))^alpha*(R*beta/((alpha + beta)*p_y))^beta/R,
y: R*beta/((alpha + beta)*p_y),
x: R*alpha/((alpha + beta)*p_x)}
sage: z[0][x]
R*alpha/((alpha + beta)*p_x)
sage: z[0][y]
R*beta/((alpha + beta)*p_y)
You can pass a dictionary for substituting:
sage: U.subs(z[0])