#4721: [with patch; needs review] Indefinite integration for piecewise functions
-------------------------+--------------------------------------------------
Reporter: pbutler | Owner: burcin
Type: enhancement | Status: new
Priority: minor | Milestone: sage-3.4.1
Component: calculus | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by wdj):
The last two patches together (first patch #3 then the "default" patch)
apply cleanly to 3.3.alpha2. They also pass sage -t.
A few comments:
1) You have
{{{
sage: f1(y) = (x+3)^2
sage: f2(y) = x+3
sage: f3(y) = 3
sage: f = Piecewise([[(-infinity, -3), f1], [(-3, 0), f2],
[(0, infinity), f3]])
sage: f.integral()
Piecewise defined function with 3 parts, [[(-Infinity, -3),
(x^3 + 9*x^2 + 27*x)/3 + 9],
[(-3, 0), (x^2 + 6*x)/2 + 9/2], [(0, +Infinity), 3*x + 9/2]]
}}}
in the docstring. Is this mixing of x's and y's intended or a typo? If
intended, why?
2) I would have perferred that you add yourself to the AUTHR field at the
top and add
{{{
AUTHOR:
P Butler
}}}
in the docstring of the function itself. Not crutial, but it will help
others in the future know which part is whose.
3) You have the comment:
{{{
# if this piece starts at negative infinity, we won't
# try to compute the definite integral of the piece.
}}}
yet you have the definite integral
{{{
sage: f1(x) = e^(-abs(x))
sage: f = Piecewise([[(-infinity, infinity), f1]])
sage: f.integral(definite=True)
2
}}}
Could you explain this please? I think maybe you meant to say
"...try to compute the indefinite...":
{{{
sage: f.integral()
Piecewise defined function with 1 parts, [[(-Infinity, +Infinity),
-integrate(e^(-abs(x)), x, x, +Infinity)]]
}}}
If so, could you add this example and comment to the docstring please?
If you agree to all this, could you just make a small patch to go on top
of the previous 2 so I can just apply it in my clone, run sage -t, and
give this a positive review?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4721#comment:15>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---