-
Notifications
You must be signed in to change notification settings - Fork 54
Fix printing log function for numeric solver expressions #1250
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
base: master
Are you sure you want to change the base?
Conversation
|
Either |
The model has an When the solver returned by the ode-toolbox is |
| return 'ln({!s})' | ||
|
|
||
| if function_name == PredefinedFunctions.LOG10: | ||
| return 'log10({!s})' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return 'log10({!s})' | |
| return 'log({!s, 10})' |
sympy.log10() does not exist. Do you know why this was working before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange. I also have log10 in the test in this PR, and the test doesn't fail.
|
|
||
| if function_name == PredefinedFunctions.LN: | ||
| return 'log({!s})' | ||
| return 'ln({!s})' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sympy.ln() and sympy.log() are the same function, so this should be equivalent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I replaced it because of the error when using log functions in ODEs with a numeric solver. See here.
The predefined functions
ln()andlog(), when used in theequationsblock in the ODEs, result in a compilation error when a numeric solver is selected.Currently, the
ln()function is passed aslog()to the ode-toolbox, which results in the error. According to the sympy docs,loghas an aliasln(). Thus, replacinglogwithlnin the ode-toolbox printer fixes the error.