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

solveset(sin(pi*x), x, domain=S.Reals) doesn't give the solution #11218

Closed
asmeurer opened this issue Jun 9, 2016 · 4 comments · Fixed by #19507
Closed

solveset(sin(pi*x), x, domain=S.Reals) doesn't give the solution #11218

asmeurer opened this issue Jun 9, 2016 · 4 comments · Fixed by #19507

Comments

@asmeurer
Copy link
Member

asmeurer commented Jun 9, 2016

See https://stackoverflow.com/questions/37603511/sympy-solve-for-all-solutions-on-domain.

In [2]: solveset(sin(x), x, domain=S.Reals)
Out[2]: {2⋅n⋅π | n ∊ ℤ} ∪ {2⋅n⋅π + π | n ∊ ℤ}

In [3]: solveset(sin(pi*x), x, domain=S.Reals)
Out[3]:
⎧               ⎛ 2⋅ⅈ⋅π⋅x    ⎞  -ⅈ⋅π⋅x     ⎫
⎪            -ⅈ⋅⎝ℯ        - 1⎠⋅ℯ           ⎪
⎨x | x ∊ ℝ ∧ ────────────────────────── = 0⎬
⎪                        2                 ⎪
⎩                                          ⎭
@kshitij10496
Copy link
Member

For solving trigonometric functions, we rewrite them in terms of exponential function.
As can be seen in this example, we cannot solve all the corresponding exponential equations.

However, some can be solved via solve_decomposition. #11141
I have been working on solving this particular example for some time.

@oscarbenjamin
Copy link
Contributor

This works fine-ish now in master:

In [5]: solveset(sin(x), x, domain=Reals)                                                                                                                     
Out[5]: {2⋅n⋅π | n ∊ ℤ} ∪ {2⋅n⋅π + π | n ∊ ℤ}

That should simplify a bit but it is an explicit form of the solution.

@asmeurer
Copy link
Member Author

The problem is with the sin(pi*x) version. I still get the nonuseful result for it in master.

@gschintgen
Copy link
Contributor

With the draft PR #19507:

In [4]: solveset(sin(pi*x), x, domain=S.Reals)
Out[4]:
                ⎧2⋅n⋅π + π        ⎫
{2⋅n | n ∊ ℤ} ∪ ⎨───────── | n ∊ ℤ⎬
                ⎩    π            ⎭

In [5]: simplify(_)
Out[5]: {2⋅n | n ∊ ℤ} ∪ {2⋅n + 1 | n ∊ ℤ}

gschintgen added a commit to gschintgen/sympy that referenced this issue Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants