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

Enable numerical evaluation of complex valued implemented functions #20538

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

riemarc
Copy link

@riemarc riemarc commented Dec 3, 2020

Brief description of what is fixed or changed

Consider the the following implemented function f_imp

def f_num(x): return x + 1
f_sym = sp.Function("f", real=False)
f_imp = implemented_function(f_sym, f_num)

At the moment it is only possible to get a numerical value if the return value of f_num is real valued, for example

print(f_imp(1).evalf())

With this pr also

print(f_imp(1j).evalf())

provides the correct complex value.

Release Notes

  • core
    • Enable numerical evaluation of complex valued implemented functions

@sympy-bot
Copy link

Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • core
    • Enable numerical evaluation of complex valued implemented functions (#20538 by @riemarc)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.8.

Click here to see the pull request description that was parsed.
#### Brief description of what is fixed or changed

Consider the the following implemented function `f_imp`
```
def f_num(x): return x + 1
f_sym = sp.Function("f", real=False)
f_imp = implemented_function(f_sym, f_num)
```

At the moment it is only possible to get a numerical value if the return value of `f_num` is real valued, for example
```
print(f_imp(1).evalf())
```

With this pr also
```
print(f_imp(1j).evalf())
```
provides the correct complex value.


#### Release Notes

<!-- BEGIN RELEASE NOTES -->
* core
  * Enable numerical evaluation of complex valued implemented functions
<!-- END RELEASE NOTES -->

@codecov
Copy link

codecov bot commented Dec 4, 2020

Codecov Report

Merging #20538 (22284aa) into master (ad63fcc) will increase coverage by 0.017%.
The diff coverage is 63.000%.

@@              Coverage Diff              @@
##            master    #20538       +/-   ##
=============================================
+ Coverage   75.740%   75.757%   +0.017%     
=============================================
  Files          673       673               
  Lines       174330    174445      +115     
  Branches     41185     41202       +17     
=============================================
+ Hits        132039    132156      +117     
- Misses       36567     36571        +4     
+ Partials      5724      5718        -6     

@oscarbenjamin
Copy link
Contributor

Closing and reopening to restart the tests.

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

Successfully merging this pull request may close these issues.

None yet

4 participants