Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

Assume a function is real-valued

asked 3 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
4

answered 3 years ago

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!

Preview: (hide)
link

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: 3 years ago

Seen: 575 times

Last updated: Feb 28 '22