SAGE gave me this strange result when attempting to integrate a
piecewise-defined function:

  sage: v,x=var('v,x')
  sage: def chi_squared_pdf(x,v):
  ....:     if x > 0:
  ....:         return 1/( 2^(v/2) * gamma(v/2) ) * x^(v/2 - 1) * exp(-
x/2)
  ....:     else:
  ....:         return 0
  ....:
  sage: integrate(chi_squared_pdf(x,24), x, 364/10, infinity)
  0

The error goes away when I try this:

  sage: def f(x,v): return 1/( 2^(v/2) * gamma(v/2) ) * x^(v/2 - 1) *
exp(-x/2)
  ....:
  sage: integrate(f(x,24), x, 364/10, infinity)
  560147352029072813039*e^(-91/5)/139218750000000

SAGE does seem to have accepted my definition of the function
chi_squared_pdf:

  sage: chi_squared_pdf(364/10,24)
  506240953553539690213*e^(-91/5)/556875000000000

I'm not sure why it won't integrate it.  Am I doing something wrong?

Sincerely,
Greg

    ------------------------------------------------
   | Greg Marks                                     |
   | Department of Mathematics and Computer Science |
   | St. Louis University                           |
   | St. Louis, MO 63103-2007                       |
   | U.S.A.                                         |
   |                                                |
   | Phone: (314)977-7206                           |
   | Fax: (314)977-1452                             |
   | Web: http://math.slu.edu/~marks                |
    ------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to