#8321: numerical integration with arbitrary precision
-------------------------------+--------------------------------------------
Reporter: burcin | Owner: burcin
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.6
Component: symbolics | Keywords: numerics,integration
Author: Stefan Reiterer | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------------+--------------------------------------------
Comment(by maldun):
I suggest the following doctests for integral.py:
{{{
#Testing Runge's example:
sage: f(x) = 1/(1+25*x^2)
sage: f
x |--> 1/(25*x^2 + 1)
sage: integrate(f(x),x,-1,1)
2/5*arctan(5)
sage: integrate(1/(1+10^10*x^2),x,0,1)
1/100000*arctan(100000)
sage: integrate(1/(1+10^10*x^2),x,0,1).n()
0.0000157078632679490
#Highly oscillating integrals:
sage: integrate(exp(x)*sin(1000*x),x,0,pi/2)
-1000/1000001*e^(1/2*pi) + 1000/1000001
sage: integrate(exp(x)*sin(1000*x),x,0,pi/2).n()
-0.00381047357049178
sage: from sage.symbolic.integration.integral import
definite_integral
sage: definite_integral(exp(10*x)*sin(10000*x), x, 0, 1)
1/10000010*e^10*sin(10000) - 100/1000001*e^10*cos(10000) +
100/1000001
sage: definite_integral(exp(10*x)*sin(10000*x), x, 0, 1).n()
2.09668650785505
#Different tests:
sage: integrate(sin(x^3)*x^2,x,0,10)
-1/3*cos(1000) + 1/3
sage: integrate(sin(x^3)*x^2,x,0,10).n()
0.145873641236432
sage: integrate(sin(x)*exp(cos(x)), x, 0, pi)
-e^(-1) + e
sage: integrate(sin(x)*exp(cos(x)), x, 0, pi).n()
2.35040238728760
sage: integrate(x*log(1+x),x,0,1)
1/4
sage: integrate(x*log(1+x),x,0,1).n()
0.250000000000000
"""
}}}
Further Ideas?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8321#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
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.