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

New section in solver documentation (Expressions we can not solve) and updated symbolic_solve docstring #1258

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

n0rbed
Copy link
Member

@n0rbed n0rbed commented Sep 4, 2024

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.34%. Comparing base (47cfd60) to head (f827c89).
Report is 103 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1258       +/-   ##
===========================================
+ Coverage    8.30%   80.34%   +72.03%     
===========================================
  Files          46       47        +1     
  Lines        4549     4640       +91     
===========================================
+ Hits          378     3728     +3350     
+ Misses       4171      912     -3259     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

1-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
(-slog(2) - log(complex(-1)) + 3slog(5)) / (slog(2) - slog(5))

julia> eval.(Symbolics.toexpr.(roots))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not recommend eval for this. Instead, subtitute?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

symbolics_to_float?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

substitute works, symbolic_to_float doesnt though.

julia> roots
1-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
 (-slog(2) - log(complex(-1)) + 3slog(5)) / (slog(2) - slog(5))

julia> Symbolics.substitute(roots[1], Dict())
-4.512941594732059759689023145584186058252768936052415430071569066192919491762214 + 3.428598090438030380369414618548038962770087500755160535832807433942464545729382im

julia> Symbolics.symbolic_to_float.(roots)
ERROR: UndefVarError: `_x` not defined

Also, using eval.(Symbolics.toexpr.(roots)) has never failed for me, why should we not use it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You never want to use eval if you don't have to. It's a call out to the compiler. It has some odd behavior, such as for example, if you put it inside of a function it will have different behavior than in a function (since then it's no longer in a dynamic scope)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, got it. Well, till symbolic_to_float is fixed id guess ill keep it like this.
Also one point: i guess the user doesnt care if it has odd behavior when used in code or not since most likely itll be used in the REPL. Right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try it again now that #1267 is in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works nice

@ChrisRackauckas ChrisRackauckas merged commit 6366280 into JuliaSymbolics:master Sep 9, 2024
11 checks passed
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

Successfully merging this pull request may close these issues.

3 participants