Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input to holomorphic_grad is not complex #577

Open
zhengqigao opened this issue Apr 13, 2022 · 0 comments
Open

Input to holomorphic_grad is not complex #577

zhengqigao opened this issue Apr 13, 2022 · 0 comments

Comments

@zhengqigao
Copy link

Hi, I have a test case for the holomorphic_grad() function.

def trial_func(x):
    return (x + 1.0j) * (x + 1.0j)

my_grad  = holomorphic_grad(trial_func)
print("grad 1 is:", my_grad(1.))
print("grad 2 is:", my_grad(-(1.j)**2))

It prints out

grad 1 is: 2.0
grad 2 is: (2+2j)

with a warning 'Input to holomorphic_grad is not complex' for the first case. I am a bit confused about the logic here. Intuitively, I think they should return the same results? Does this mean we need to make a pure real number written in the format of a complex number?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@zhengqigao and others