Python Forum
Calculating of difficult integrals in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculating of difficult integrals in python
#1
I have some problems in my scientific research with numerical modeling in Python. I do my research in Jupyter notebook (Anaconda).
I have a difficult integral that includes other integrals: Big integral[Integral]https://i.stack.imgur.com/fE3kS.jpg[/img]
Where S(x) and E(x) are integrals too: S-integral [S-integral]https://i.stack.imgur.com/lBasi.jpg[/img] E-integral [E-integral]https://i.stack.imgur.com/N3CNL.jpg[/img]
And S' is a derivative S(x) with respect to x.
My to-do list includes:
1.To make a numerical model of s-integral:
def s(x):
    def spec(y,x):
        y2=z**2
        x2=x**2
        k=np.sqrt(y2+x2)
        e=np.exp(k)
        return (k+y2/(3*k))*y2/(e+1)
    i=quad(spec, 0, np.inf, args=(x))
    return 1+(45/2pi**4)*i[0]
This part is certainly correct. (When I tried x=0 then s(x)=2.75)

To Make a numerical model of E-integral. (I think I have right solution although I don't have any confirmation in book.)

To get a derivative of S(x) with respect to x. How Can I do it without manual calculation? It is a problem because integrand is rather big for numerical methods (or I don't know how I can do it).

After uniting this functions I have to calculate indefinite integral, but when I do it manually, jupyter gives a NaN massive with big amount of warnings such as overflow encountered in exp, in double scalars and slowly convergent integrals.

I'm soory for URL's:
Main int:
[Image: fE3kS.jpg]
S int:
[Image: lBasi.jpg]
E-int:
[Image: N3CNL.jpg]

Warnings:
Error:
C:\Users\Enitorc\Anaconda3\lib\site-packages\ipykernel\__main__.py:40: RuntimeWarning: overflow encountered in double_scalars C:\Users\Enitorc\Anaconda3\lib\site-packages\ipykernel\__main__.py:39: RuntimeWarning: overflow encountered in exp C:\Users\Enitorc\Anaconda3\lib\site-packages\ipykernel\__main__.py:40: RuntimeWarning: invalid value encountered in double_scalars C:\Users\Enitorc\Anaconda3\lib\site-packages\scipy\integrate\quadpack.py:356: IntegrationWarning: The occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. The error may be underestimated. warnings.warn(msg, IntegrationWarning)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Star Formula function (not too difficult i think) Jam_XD02 6 3,576 Aug-28-2021, 04:19 AM
Last Post: ndc85430
  Python Coding Help: Calculating Sums bperez 9 3,483 Jan-18-2021, 07:25 AM
Last Post: perfringo
  Calculating BLEU scores in Python kg17 1 2,537 Jan-12-2021, 08:26 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020