On Thu, Jan 15, 2015 at 9:19 PM, Nathann Cohen <[email protected]> wrote:
> Hello everybody,
>
> The function numerical_integral is meant to compute an integral in one
> dimension.
>
> It takes as mandatory arguments:
> - A function (dependin on any number of variables)
> - The bounds of the integration domain
>
> As you can see, the integration variable is not given explicitly. As
> the function must be numerical, all other symbolic variables involved
> in f must be given a numerical value: this is done with the 'params'
> parameter:
>
> numerical_integral(a+b+c+d+e+f+g+h, 0,1,[3,4,5,6,7,8,9])
>
> This will replace the values of variables "b,c,d,e,f,g,h" with the
> values [3,4,5,6,7,8,9] before any actual integration, but it never
> appears explicitly WHICH of the variables will receive each value.
>
> This 'params' argument is confusing and can lead to mistakes (see
> comments from #17507), but how should it be changed ?
>
> 1) We remove it, making it mandatory for f to depend on one variable
> only (not very cool for newcomers?)
> 2) We request params to be a dictionary ({b:3,c:9,...}) instead of a list
> 3) We use **args for that numerical_integral(x*y,0,1,y=pi)
>
> What would be best according to you ? I also ask this question because
> I know nothing of how symbolics work in Sage, and I do not know if
> similar functions have similar standards.

We (probably me and *Josh Kantor*?  it was a while ago) wrote
numerical_integral in Sage before we had symbolics, and barely touched
it since.     I was writing an example for the new SMC button bar to
illustrate numerical_integral yesterday and was struck by how archaic
it felt, in precisely some of the ways you mention above.  Even having
it return a list of two numbers, rather than an interval (?) or just a
number and having an option to get the error, feels funny to me.   But
of course we wrote numerical_integral before Sage had interval
arithmetic too.

I would recommend looking up what Maple and Mathematica (and Matlab)
do regarding their numerical integration API and summarizing each here
before making any decisions.  All their docs are easily available
online, and I tend to thing that doing something consistent with
Mathematica (say), if it is *reasonably* sensible in Sage, is often
the best approach for this sort of thing, because it makes it easier
for people who are used to using Mathematica.      I definitely don't
recommend just coming up for some completely new API for numerical
integration without even looking at what Mathematica does, though I
think that's probably what Josh Kantor and I did long ago to Sage...

William


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to