-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Bug in fourier_transform #22787
Comments
can I be assigned @oscarbenjamin |
@theartpiece issues are not generally assigned in sympy . If you want to try it out surely you could go forward and if you face any difficulties during debugging or don't understand something you can comment that here . |
@mathcube7 in general this function seems to behave incorrectly. |
yeah so basically the problem lies here sympy/sympy/integrals/transforms.py Line 1499 in 00d6469
First of all, the problem occurs only when the transformation returns a piecewise function. In this case, fourier returns the first part of the piecewise function (where I think the author assumed that the first part corresponds to the positive case, i.e., x>0 ). SUGGESION- Add another function f in the return output such that f(x)=f(-x). |
@oscarbenjamin Let me know if it makes sense and I'll make a PR. |
That code definitely looks suspect. In this case there are nested Piecewise so |
How do you add unit tests? |
Tests are added in the corresponding test file for the file in which the change was made. for integrals/transforms.py, the tests are added in integrals/tests/test_transforms.py sympy/sympy/integrals/tests/test_transforms.py Lines 1032 to 1033 in 1409fcf
I dont think there is a guide for adding unit tests in the Development Workflow. Should I add that to the Development Workflow wiki? |
There are: (The problem is probably more that there are 592 wiki-pages...) |
Maybe the dev workflow could link to the other pages. Probably a lot of stuff could be stripped out of the dev workflow and just replaced with "here's a link for more information if needed". |
Yes, the dev workflow contains too much content and it may be difficult for a new contributor to use. And stuff like Writing tests and Adding someone to AUTHORS should be a part of Dev workflow as a new contributor would need to do these things. The wiki page has got too long to easily navigate too. |
both the functions
fourier_transform
and_fourier_transform
give the (same but) wrong result, when applied to the functionsin(x)**2/x**2
. Here is the sample code:or in formula
This cannot be true, however. As
f
is real, the Fourier transform must satisfy F*(k) = F(-k). And since the Fourier transform itself is real, it must be even: F(k)=F(-k). Obviously, the result of sympy is not.Sympy version used: 1.9
The text was updated successfully, but these errors were encountered: