Group Abstract Group Abstract

Message Boards Message Boards

0
|
32 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

My integral is running slow -- why?

Hello All,

I am still new to Mathematica. I have written the small program below and it works fine. Unfortunately, it runs slow -- it takes a few hours to complete these steps. Does anyone know how I can get things to run faster?

POSTED BY: Patrick McMullen
3 Replies

Numerically is fast:

POSTED BY: Mariusz Iwaniuk

Thank you, Mariusz. This is helpful.

POSTED BY: Patrick McMullen
Posted 17 hours ago

You can make your definition of f[t] slightly simpler

f[t_]=Piecewise[{{2 Sqrt[1-t^2]/Pi,-1<t<1},{0,True}}]

which will speed it up slightly, but that doesn't make enough of a difference.

You can look at the output from this

Plot[f[t],{t,-2,2}]

which seems to indicate that your integrand will be zero when t<=-1 or when t>=1.

Can you think for a few minutes to see whether this information might let you integrate over a far smaller range than -infinity to infinity and and get the same result while perhaps speeding up your calculation?

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard