Status: Accepted
Owner: smichr
Labels: Type-Defect Priority-Medium

New issue 1926 by smichr: ode tweaks
http://code.google.com/p/sympy/issues/detail?id=1926

There are a variety of changes that accumulated to ode in my 1766 branch.
These are some of the less major.

1) I get nervous when I see direct string addressing...I think the
endswith/startswith methods might make it clearer what is being tested.

2) has_any_symbol() is an optimized routine to use when one is looking for
a symbol. It's the fastest method at present to answer the question about
whether a symbol appears in an expression.

3) <BLANKLINE> was deleted from a docstring

4) there were some minor text-edits made.

5) in odesimp,

a) everything is made into a list and at the very end it is returned as an
expression if there is only one element. I would prefer that it always
(like solve) return a list but I didn't try to change the existing behavior

b) a couple of assertions are added to validate the expectation and
existing code.

c) a loop over items in eq is made for renumbering. There are several cases
that were being skipped (but not generating an error) that involved lists.
To see them put the line "assert len(eq)==1" just before this loop.

6) as it's faster to test for inclusion in a set rather than a list, I made
some changes like that.

7) The sentence "The function is implemented recursively." got orphaned
from another docstring, I believe. So I deleted it.

TODO: In checkode there is a logical error in the ode code where
ode_or_bool is simplified rather than the sides of the Eq that exist at
that point. The effect is the it was never simplified since simplify
doesn't handle Eqs. Should it? I would like to make this simple change:

                    ode_or_bool = Eq(lhs, rhs)
                    if isinstance(ode_or_bool, bool):
                        if ode_or_bool:
                            lhs = rhs = S.Zero
                    else:
                        lhs = simplify(lhs)
                        rhs = simplify(rhs)

but this breaks tests. If someone can fix it easily, that would be nice.
Otherwise I have a rather large-scale fix for such woes in 1766.


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to