On Sat, Mar 16, 2013 at 9:02 PM, David Li <li.david...@gmail.com> wrote:
> Okay, I'll start on that once I manage to get the integration algorithm to
> handle most problems that a high-school/freshman college student would
> encounter. (Currently it won't handle any trig integrands involving more
> than a u-substitution, and does not use integration by parts.)

Actually, trig integrals (like sin^n*cos^m) are one example of
integrals that are computed exactly as you learned in calculus, via
the reduction formula*.  So you could look into extending
trigintegrate to work with this.

(*) With the caveat that if the integral is reduced to a rational
function via a substitution, it is computed with ratint, which works
nothing like the partial fractions that you learned in calculus. For
example, the integral of tan(x) is reduced to the integral of u/(1 -
u**2), where u = sin(x).

Aaron Meurer

>
> Perhaps the derivative implementation doesn't need to be in SymPy? I haven't
> seen a case yet where it provides a better result (usually it is less
> simplified, especially when trigonometry is involved).

Actually, you could argue for that. Once you generalize it to use diff
automatically, it should just be a few lines, so perhaps it should
just live entirely in SymPy Gamma.  It can be a good example of what
you can do with SymPy without editing library code.

Aaron Meurer

>
> On Saturday, March 16, 2013 7:57:12 PM UTC-7, Aaron Meurer wrote:
>>
>> This is something SymPy wants. It's even on the GSoC ideas list.
>>
>> I would put the integration stuff in the integration module. As I
>> pointed out on the pull request, what you really have here is a new
>> integration heuristic, which can (should) be "integrated" with
>> integrate() itself.  It is already giving better results than
>> integrate() for some integrals (namely the one you posted as your
>> example).
>>
>> The diff code I'm not sure. I guess it could go in the same file for
>> now. If you derive the rules automatically, then the code will be
>> short (it will only consist of special cases like Add and Mul).
>>
>> In general, there are a lot of things that this could be applied to
>> beyond diff() and integrate(): solve(), simplify(), the core (like x +
>> x => 2*x).  For some, the code could naturally live very close to the
>> code that currently does the work. For others, the way that the
>> algorithm works and the way it works "by hand" are much different.
>>
>> To be clear, the symbolic manipulation should go in SymPy. The part
>> about the text "now make the u substitution u = exp(x)" or the css
>> formatting should go in SymPy Gamma. The SymPy objects should be easy
>> to parse into those things, but they should be intended for machine
>> consumption more than human consumption.
>>
>> Aaron Meurer
>>
>> On Sat, Mar 16, 2013 at 8:47 PM, David Li <li.da...@gmail.com> wrote:
>> > Alright, thank you for pointing out that typo. I've fixed it.
>> >
>> > I have finished porting; the code is still at the same place,
>> > https://github.com/sympy/sympy_gamma/pull/8. If this is something SymPy
>> > would want, how best should be integrated? Which module(s) does it
>> > belong in
>> > and what should the API be?
>> >
>> > On Saturday, March 16, 2013 6:34:22 AM UTC-7, Ramana Venkata wrote:
>> >>
>> >> Hi David,
>> >>
>> >> Great work. Just wanted to point you out one small thing in
>> >>
>> >> http://sympy-gamma-li.appspot.com/input/?i=integrate%28exp%28x%29%20/%20%281%20%2B%20exp%282x%29%29%29
>> >> In the first step after "Let u = e^x"; "then let du = e^x ..." But I
>> >> think
>> >> it be some thing like this "then du = e^x dx ..."
>> >>
>> >>
>> >> On Thursday, March 14, 2013 8:52:25 PM UTC+5:30, 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+un...@googlegroups.com.
>> > To post to this group, send email to sy...@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.
>> >
>> >
>
> --
> 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.
>
>

-- 
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