Hi Ross,
On Sun, 2 May 2010 19:43:17 -0700 (PDT)
Ross Kyprianou <
ros...@gmail.com> wrote:
> > You should add a new integrator function and register it in the
> > dictionary sage.symbolic.integration.integral.available_integrators.
> >
> > At some point we also need to come up with a protocol to allow these
> > functions to transform the input and pass it on to be processed by
> > the next one in the queue.
>
> So I guess registering means adding (to
> sage.symbolic.integration.integral) the last line (shown here)
>
> available_integrators['maxima'] = external.maxima_integrator
> available_integrators['sympy'] = external.sympy_integrator
> available_integrators['mathematica_free'] =
> external.mma_free_integrator
> available_integrators['sage'] = external.sage_integrator
>
> and including a corresponding function to
> sage.symbolic.integration.external
You are on the right track. Sorry for not being more explicit before.
Note that most of this is new and we are just developing the necessary
framework as we go along. Your example is a good test case, so please
keep on trying, sending emails, and poking people (me) to work on this.
I suggest giving a more specific name to your function. Assuming that
you're working on the erf function, erf_integrator() might be a good
name.
You should definitely add your function to the list of available
integrators. This will let people use only your function if they want
to, by using the algorithm keyword argument of the top level integrate
function.
The new function you implement doesn't need to go in the file
sage/symbolic/integration/external.py. That file contains the
routines which call external systems for integration. I suggest putting
a new file in sage/symbolic/integration, or adding it somewhere close
to the definition of the erf() function.
Later we can also consider letting functions automatically register
custom integration routines, similar to the way they register custom
numeric evaluation or differentiation methods. I don't really like this
idea, since the order we call these functions might be important.
Can you post some example code (your integrator function) so I have
something to experiment with?
> I think the aim would be that anybody needing a known integral that is
> not caught by the other 3 integrators, patching this integral in this
> "last chance" "sage" integrator which we have more control over than
> the other integrators. (Alternatively, can we patch into sympy as an
> alternative and get an upstream update to their integrator instead?)
>
> Ive looked at the 1-2 year old threads in this list on integration and
> I guess most of the discussion have been implemented. It seems the
> schema above was implemented so we are using existing integrators
> rather than opting to recreate another large internal integrator (is
> that correct?). If so, it might be that the integrals made available
> very quickly with patches to this new sage integrator would ideally
> find themselves implemented in maxima and/or sympy eventually and
> dropped from this new sage integrator to keep it compact.
We are definitely aiming to implement symbolic integration natively in
Sage. There are some existing implementations even. It's just a matter
of getting things cleaned up and submitted to Sage. Since the work
is done for research, it can be hard to get them ready for public
consumption. :)
> Regardless of the responses to the above, is the following what I
> should implement?
> 1) Add to sage.symbolic.integration.integral.available_integrators...
> available_integrators['sage'] = external.sage_integrator
You should also add it to the lists on line 60 and 146 of
sage/symbolic/integration/integral.py.
> 2) Include a corresponding function (to return the integral result) in
> sage.symbolic.integration.external
> def sage_integrator(expression, v, a=None, b=None):
> ...
Thanks.
Burcin