computer algebra systems - Can I substitute using a symbolic equation in Sage? -
i using following map in sage:
f = lambda x: sgn(x)*sgn(x);
which evaluates f(x) = 0 x=0 , f(x)=1 x!=0;
in symbolic results, sgn(x)^2, sgn(x)^4 , sgn(x)^8, etc. being treated unequal, though equal values of x. there way can substitute like:
sgn(x)^2 == sgn(x)^4 == sgn(x)^8
for occurrences of these relations, , symbolic values of x?
i create new substitution rule every symbol, e.g.
result.subs(sgn(c)^2 == sgn(c)^4).subs(sgn(d)^2 == sgn(d)^4)...
and on, seems hard control.
this perhaps dumb question me ask... nature of result 1 factor?
sage: f(x) = sgn(x)^2 sage: f x |--> sgn(x)^2 sage: z = (1+f)^3 sage: z = z.expand() sage: z x |--> sgn(x)^6 + 3*sgn(x)^4 + 3*sgn(x)^2 + 1 sage: z.factor() x |--> (sgn(x)^2 + 1)^3
in case makes question moot, hopefully:
sage: z.subs(sgn(x)^2==x) x |--> (x + 1)^3
not that subs, example.
Comments
Post a Comment