Can you anticipate all the possible ways of misusing a command, and
catch them all
with a suitable error message?  I think that's pretty hard with a
system that has essentially
free-form input of any length, attached to fairly vague semantics
(like --- let's see what
Maxima does with this ---).

RJF



On Aug 18, 8:37 pm, Robert Bradshaw <rober...@math.washington.edu>
wrote:
> On Aug 18, 2009, at 6:55 PM, Golam Mortuza Hossain wrote:
>
>
>
>
>
> > Hi,
>
> > On Tue, Aug 18, 2009 at 9:27 PM, William Stein<wst...@gmail.com>  
> > wrote:
>
> >>> ----------
> >>> 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.
>
> >> Matheamatica just considers this input to be invalid:
>
> >> sage: mathematica.eval('Integrate[f[x],x^2]')
>
> >>                                                              2
> >> Integrate::ilim: Invalid integration variable or limit(s) in x .
>
> >>                         2
> >>        Integrate[f[x], x ]
>
> >> Unless you can give a explanation of what you want integrating wrt  
> >> x^2
> >> to mean, I think we should also raise an error in Sage.
>
> > I tried that input out of curiosity during testing. I was expecting
> > a TypeError but instead I got an answer !!
>
> > I agree, we should raise an error. Ironically,  in "calculus.py"  
> > the raise
> > error line (556) has been commented out for some reason.
> > -----------
> >     elif not is_SymbolicVariable(v):
> >         v = var(repr(v))
> >         #raise TypeError, 'must integrate with respect to a variable'
>
> Probably var(repr(var)) is the wrong thing to do here... I have a  
> feeling I've seen this code before.
>
> - Robert
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to