Ask Your Question
2

Assume a function is real-valued

asked 2022-02-27 20:45:00 +0100

ripple_carry gravatar image

In the following expression:

var('z')

u = function('u')(z)
v = function('v')(z)

f = u + i * v

show(f.diff(z).conjugate().expand().simplify_full())
# conjugate(diff(u(z), z)) - I*conjugate(diff(v(z), z))

I would like Sage to make the simplification conjugate(diff(u(z), z)) = diff(u(z), z) because $u, v$ are intended to be real-valued. But my first attempt:

assume(u, 'real')

didn't work:

TypeError: self (=u(z)) must be a relational expression

What is the right way to write this assumption?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2022-02-28 17:22:39 +0100

dsejas gravatar image

Hello, @ripple_carry! The easiest way I know of achieving that effect is to explicitly declare the imaginary part of the function to be zero. Just use the imag_part_func argument for function as follows:

var('z')

u = function('u',imag_part_func=0)(z)
v = function('v',imag_part_func=0)(z)

f = u + i * v

show(f.diff(z).conjugate().expand().simplify_full())

This outputs

diff(u(z), z) - I*diff(v(z), z)

Hope this helps!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-02-27 20:45:00 +0100

Seen: 550 times

Last updated: Feb 28 '22