On Tue, Aug 18, 2009 at 5:27 PM, William Stein<[email protected]> wrote:
>
> On Tue, Aug 18, 2009 at 3:51 AM, Golam Mortuza
> Hossain<[email protected]> wrote:
>>
>> Hi,
>>
>> While testing new integral SFunction class for Sage,
>> I encountered this weird bug.
>>
>> ----------
>> sage: f(x) = function('f',x)
>>
>> sage: f(x).integral(x)
>> integrate(f(x), x)
>>
>> sage: f(x).integral(x^2)
>> x^2*f(x)
>> -----------
>
> Indeed, what does that mean? If forced to, I would interpret this as
>
> int f(x) d(x^2) = int f(x) 2 x dx
> = 2x integrate(f(x),x)
>
> So I think the Sage/Maxima answer of x^2*f(x) is bizarre.
well, I would interpret it differently:
int f(x) d(x^2) = int f(x) 2 x dx
= 2 integrate(x*f(x),x)
in sympy we just raise an exception:
In [1]: integrate(sin(x), x)
Out[1]: -cos(x)
In [2]: integrate(sin(x), x**2)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/ondrej/repos/sympy/<ipython console> in <module>()
/home/ondrej/repos/sympy/sympy/utilities/decorator.pyc in
threaded_decorator(expr, *args, **kwargs)
54 return Add(*[ func(f, *args, **kwargs) for
f in expr.args ])
55 else:
---> 56 return func(expr, *args, **kwargs)
57
58 threaded_decorator.__doc__ = func.__doc__
/home/ondrej/repos/sympy/sympy/integrals/integrals.pyc in
integrate(*args, **kwargs)
480 """
481 new_args = [sympify(arg) for arg in args]
--> 482 integral = Integral(*new_args, **kwargs)
483
484 if isinstance(integral, Integral):
/home/ondrej/repos/sympy/sympy/integrals/integrals.pyc in __new__(cls,
function, *symbols, **assumptions)
46 continue
47
---> 48 raise ValueError("Invalid integration variable
or limits: %s" % str(symbols))
49 else:
50 # no symbols provided -- let's compute full antiderivative
ValueError: Invalid integration variable or limits: (x**2,)
Ondrej
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---