'Cannot simplify the equation where zeroes have powers
I am trying to solve an optimization problem. When I reach the first result, sympy cannot simplify my expression where zeroes have powers. Is it a bug?
import sympy as sp
from sympy import *
from sympy import solveset, S
from sympy.abc import rho
x, y, m, a, p1, p2 = sp.var('x,y,m,a,p1,p2',real=True) #define variables we need to use
u=(x**rho+y**rho)**(1/rho)
g=p1*x+p2*y-m #define constraint
lam = sp.symbols('lambda', real = True) #define lamda
L=u-lam*g #define lagrane function
L
mux=diff(u, x)
muy=diff(u, y)
mux=solve(mux, y, dict=True)
muy=solve(muy, x, dict=True)
mux=mux[0].get(y)/p1
muy=muy[0].get(x)/p2
max=Eq(mux, muy)
xs=solve(max, y, dict=True, set=True, manual=True, particular=True)
xs
``````
I have
`````
(0**rho - (p2*(0**rho - x**rho)**(1/rho)/p1)**rho)**(1/rho)
````
Solution 1:[1]
Since 0**x has at least three possibilities: zoo, 1, or 0 depending on the sign of x. If you declare rho as Symbol('rho', positive=True) the powers will reduce to 0.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | smichr |
