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
modified 'get_numbered_constants' and test 9239, added another test #15504
Changes from all commits
d04f808
71c5019
feac392
47b9f94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,10 @@ | |
Dummy, Eq, Ne, erf, erfi, exp, Function, I, Integral, LambertW, log, O, pi, | ||
Rational, rootof, S, simplify, sin, sqrt, Subs, Symbol, tan, asin, sinh, | ||
Piecewise, symbols, Poly, sec, Ei) | ||
from sympy.solvers.ode import (_undetermined_coefficients_match, checkodesol, | ||
classify_ode, classify_sysode, constant_renumber, constantsimp, | ||
homogeneous_order, infinitesimals, checkinfsol, checksysodesol, solve_ics, | ||
dsolve) | ||
from sympy.solvers.ode import (_undetermined_coefficients_match, | ||
checkodesol, classify_ode, classify_sysode, constant_renumber, | ||
constantsimp, homogeneous_order, infinitesimals, checkinfsol, | ||
checksysodesol, solve_ics, dsolve, get_numbered_constants) | ||
from sympy.solvers.deutils import ode_order | ||
from sympy.utilities.pytest import XFAIL, skip, raises, slow, ON_TRAVIS | ||
|
||
|
@@ -2957,20 +2957,21 @@ def test_dsolve_linsystem_symbol(): | |
Eq(g(x), -C1*eps*sin(eps*x) + C2*eps*cos(eps*x))] | ||
assert checksysodesol(eq1, sol1) == (True, [0, 0]) | ||
|
||
|
||
|
||
def test_C1_function_9239(): | ||
t = Symbol('t') | ||
C1 = Function('C1') | ||
C2 = Function('C2') | ||
C3 = Symbol('C1') # XXX: update these after | ||
C4 = Symbol('C2') # XXX: https://github.com/sympy/sympy/issues/15056 | ||
C3 = Symbol('C3') | ||
C4 = Symbol('C4') | ||
eq = (Eq(diff(C1(t), t), 9*C2(t)), Eq(diff(C2(t), t), 12*C1(t))) | ||
sol = [Eq(C1(t), 9*C3*exp(6*sqrt(3)*t) + 9*C4*exp(-6*sqrt(3)*t)), | ||
Eq(C2(t), 6*sqrt(3)*C3*exp(6*sqrt(3)*t) - 6*sqrt(3)*C4*exp(-6*sqrt(3)*t))] | ||
assert checksysodesol(eq, sol) == (True, [0, 0]) | ||
|
||
|
||
def test_issue_15056(): | ||
t = Symbol('t') | ||
C3 = Symbol('C3') | ||
assert get_numbered_constants(Symbol('C1') * Function('C2')(t)) == C3 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why this file has so much empty space, but there should be only one or two blank lines between functions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed a few blank lines from the |
||
def test_issue_10379(): | ||
t,y = symbols('t,y') | ||
|
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.
Here's an example of where #15460 would apply: if all functions had a name attribute then this could be
Symbol(f.name)
. But if no function has a name attribute (as is the case in this PR), then what you have done here makes sense and will work even if a non-Undefined functions happened to have a number in the name (likelog2
).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.
@smichr Yes that makes sense. But looking at the discussion in #15460 I don't think you or @asmeurer (or in this case, me too) agree to have all the functions return a name attribute. So introducing that change (
Symbol(f.name)
) wouldn't be necessary unless we give all the functions aname
attribute.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.
@avishrivastava11 can you state whether
or
Its not a big deal either way (and this is not an accusation---I'm just trying to keep and clean open record of our development).
If you did read someone else's code to come up with this fix, then perhaps I would prefer to cherry-pick a commit from elsewhere (and then rebase your tests on top of it).
@asmeurer please do not merge until we resolve this.
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.
@cbm755 I assure you, I'm completely against plagiarism. I did this independently (and actually have been on the receiving end of someone else using my ideas, so I know how it feels and how bad it is) and therefore appreciate your concern. And yes, whenever I use someone else's commits or work, I first pull their commits in the PR and then work on top of them and also give them credit for it (you can take a look at a few of my previous PRs)
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.
I did not mean to suggest anything inappropriate had happened; please accept my apologies if you felt threatened by my comments.
@asmeurer an equivalent change was done in Diofant (which Github has linked to my original bug report). We could've simply cherry-picked that change but no one did so. Instead, we have what I believe to be an independently written solution (based on a different variable name and a clear statement from the author).
I'm now +1 for this change after minor reformating.