Okay, so I'd just like to make sure I'm using strategies/rules correctly. I 
have the gist of the derivative implementation at 
https://gist.github.com/lidavidm/5171100.

   - The rules convert the function to be differentiated into a namedtuple 
   corresponding to the derivative rule to be applied.
   - Two strategies are used: one is an identity (I'll replace it with the 
   identity strategy in SymPy) and the other evaluates the rule.
   - The switch strategy is used to determine which rule to apply.
   - The rules all operate on Derivative objects so as to keep the function 
   and the variable of differentiation together as one object. (Perhaps just 
   using a namedtuple would be clearer, though.)

This separates the decision of which rule to use, the processing of the 
input, and the evaluation of the derivative.

If this an "idiomatic" use of strategies then I'll convert the rest of the 
code.

On Thursday, March 14, 2013 8:22:25 AM UTC-7, David Li wrote:
>
> Hello all,
>
> I have implemented a module giving steps for most derivatives and some 
> integrals for SymPy Gamma. However, it was suggested that at least some of 
> this functionality should be added to SymPy itself. If so, what 
> functionality should be added and how should it be integrated into SymPy?
>
> The pull request is at https://github.com/sympy/sympy_gamma/pull/8. There 
> is still some work left to do, which is listed in the pull request. In 
> particular, integral forms involving the application of trigonometric 
> identities need to be implemented.
>
> Examples:
>
>    - Integral involving arctangent and exponentiation: 
>    
> http://sympy-gamma-li.appspot.com/input/?i=integrate%28exp%28x%29%20/%20%281%20%2B%20exp%282x%29%29%29
>    - Trig integral involving u-substitution: 
>    
> http://sympy-gamma-li.appspot.com/input/?i=integrate%28sin%28sin+x%29cos+x%29
>    - Trig derivative: 
>    http://sympy-gamma-li.appspot.com/input/?i=diff%28cot+sin+x%29
>
> Implementation:
>
> The module builds a tree of rules to apply, with the first rule on the top 
> of the tree. Examples of rules would be AddRule, ChainRule, RewriteRule, 
> AlternativeRule (in case multiple methods exist), and so on. Separate 
> functions apply the rules and return the resulting derivative or integral 
> (currently derivatives and integrals are separate functions). A set of 
> classes walks the tree and generates steps for the rules; there is no 
> translation support but multiple output formats should work (currently only 
> plaintext and HTML+LaTeX are implemented).
>
> The code makes use of context managers, which would need to be replaced in 
> order to maintain Python 2.5 compatibility. 
>
> Thank you,
> David Li
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to