# assume and simplify Anonymous

Hello,

assume(u,'complex') ; assume(v,'complex'); assume(u==conjugate(v)) ;
u-conjugate(v)


returns

u-conjugate(v)


whereas I was expecting

0


What should I do if I want to simplify some computation involving complex numbers along with their conjugates?

edit retag close merge delete

Sort by » oldest newest most voted

I think the problem is that you are using assume in some steps when you just need assignment. The code below produces a result of 0.

var('v')
assume(v,'complex')
u=conjugate(v)
u-conjugate(v)

more

But in some case we can't replace an assumption with an assignment. For exemple if we know that x²=y³, but both x and y are unknown, one would expect x**2-y**3 to return 0 I guess sage doesn't perform this kind of things?

Yeah, I don't think that this kind of "assumption" is doable in Maxima (which does our assumptions under the hood). But @achrzesz has the usual way to handle this kind of thing, via substitution and/or pattern matching, which hopefully is what you are looking for.

sage: var('x y');
sage: (x^2-y^3).subs_expr(x^2==y^3)
0
sage: (x-conjugate(y)).subs_expr(x==conjugate(y))
0
sage: maxima('x^2-y^3,x^2=y^3')
0
sage: maxima('x-conjugate(y),x=conjugate(y)')
0
#replace x^2 by y^3 in x^4-y^6
sage: maxima('ratsubst(y^3,x^2,x^4-y^6)')
0
#simplify according to the rules
sage: maxima('scsimp(x^4-y^6,x^2=y^3)')
0

more

This doesn't perform any nontrivial simplification, for example x^4-y^6 doesn't return 0. But still my question was answered. Thanks everyone.