On Sep 17, 4:45 am, Mizuchi <ytj...@gmail.com> wrote:
> Sometimes we only care about the cauchy principal value. How to get it from 
> sage?

You could just use the definition:

sage: var('x,e')
(x, e)
sage: assume(e>0,e<1); integrate(1/x^3,x,-1,-e)+integrate(1/x^3,x,e,3)
4/9

In maxima_lib this line:

ecl_eval('(defun principal nil (cond ($noprincipal (diverg)) ((not
pcprntd) (merror "Divergent Integral"))))')

is responsible for installing code that throws an error rather than
print a warning. We changed it at some point because internally maxima
needs principal values to evaluate certain integrals (it has by then
ensured it's safe to do so). So if you want write a routine that gives
access to principal values this way, you'd have to create the right
cirmumstances (I guess make sure  that $noprincipal is nil and pcprntd
is T. That's how maxima fakes the code into computing a principal
value without printing a warning at some point).

See

http://trac.sagemath.org/sage_trac/ticket/11987

for details. If you do write a wrapped integration routine, make sure
to only change the value of pcprntd locally, i.e.,

(let ((pcprntd t)) (integrate ...))

and double check that evaluating a divergent integral afterwards gives
a warning again

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to