Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [numerical-integration]

Questions on the use of numerical functions NIntegrate and NDSolve.

0
votes
1answer
21 views
3
votes
2answers
102 views

NIntegrate on a solution of a matrix ODE

I've seen similar questions on this site but somehow the solutions there didn't manage to solve my specific problem. I have a function mat1 that takes a square $n \times n$ matrix G, and some final ...
3
votes
0answers
26 views

Plot BV functions with singular derivatives in multiple space dimension

In 1-dimensional setting, two key examples of $BV$ functions (of bounded variation) $u: \mathbb R \to \mathbb R$ are the Heaviside function, whose derivative is the Dirac delta concentrated at $0$. It ...
4
votes
2answers
342 views

How to evaluate this function?

I’m trying to evaluate y[t] = InverseFunction[ NIntegrate[Sqrt[2]/( -8+Exp[y]+2Exp[-y]), {y,0,t}]] Some of the problems I’m facing, is that i’d like to get the ...
5
votes
1answer
177 views
+50

Numerical methods to solve a continuity equation

What numerical methods can be used to study the initial value problem for the continuity equation where $ u = u(t, x) $ $$ u_t + \nabla\cdot(\boldsymbol b u) = 0, \qquad t \in [0,T], \quad x=(x_1,x_2)...
3
votes
0answers
130 views

Boundary conditions are not satisfied with NDSolve

I want to study the time evolution of a small perturbation around the static solution of the following Wave Equation $$ -\partial_t^2 v(t,r) + \partial_r^2v(t,r) + \frac{2}{r}\partial_r v(t,r) = \...
3
votes
3answers
77 views

Evaluating the error function by integrating $ \mathrm e^{−t^2} $ with Simpson's rule

I am trying to evaluate an error function with Simpson's rule because there is no other way to integrate it. The function is $$ {\rm erf}(x) = \frac{2}{\sqrt π}\int_0^x \mathrm e^{−t^2}\, \mathrm dt ...
1
vote
0answers
25 views

Speeding up solving many coupled non-linear differential equations

I am currently working on a project that involves solving many coupled non-linear ODEs$^*$ I am using NDSolveValue and the time it takes to solve everything is (understandably) slow. But I was ...
0
votes
0answers
22 views

Integrating System of ODE's

I'm trying to integrate the system $$\frac{d}{d z} \left[ \begin{array}{l}{\hat{a}} \\ {\hat{b}}\end{array}\right]=\frac{i \omega}{\overline{c}} \left[ \begin{array}{cc}{\left(\Delta_{l}^{(+)}-1\...
0
votes
1answer
45 views

Solving and Plotting an integral function

I am new in the use of Mathematica, so please forgive me.. I want to integrate and plot the following integral function: $F(x)=\displaystyle\int_x^\infty\dfrac{t\sqrt{t^2-x^2}}{e^t-1}\text{d}t$: ...
0
votes
2answers
81 views

How to plot: $\int - \frac {W(-\ln x)}{\ln x} dx$? [closed]

How would we plot: $$\int - \frac {W(-\ln x)}{\ln x} dx$$ Where $W$ is the Lambert W function?
8
votes
0answers
152 views
+350

Solving the 2D Schrödinger equation with eigensystem, then verifying orthonormality of eigenfunctions with NIntegrate

I am solving the time-independent 2D Schrödinger equation for an interacting electron and hole in the case of anisotropic electron and hole masses, where the interaction is described a modified form ...
0
votes
1answer
89 views

Numerically solve delay ODE

I am trying to numerically solve a simple delay ODE in mma for the first time. I think this is likely a simple fix. I first tried to solve system as ordinary differential equation system for up to 𝑡...
4
votes
2answers
147 views

Can I obtain more precise integration of highly oscillating integral?

I would like to numerically integrate precisely, $$ \frac{1}{2 \pi r^{n}}\int_0^{2\pi} e^{-n i t}C(t)dt$$ with $C(t)$ a single-cycled branch of the function $w(z)$ given by the implicit expression ...
0
votes
1answer
65 views

Integral doesn't evaluate as it must be! [closed]

i have this integral it must result in all constant values and the value of the integral its self which is Zeta[2/3] it can be done. ...
0
votes
0answers
24 views

Using `Integrate` and or `FourierTransform`

I have some general questions about Integrate and FourierTransform. Firstly with ...
0
votes
1answer
54 views

Speeding up double NIntegrate

I am looking to speed up an integral of the type $$ I(\omega,k,\mu,a,T,\eta) = \int_{-1}^1dx \int_0^{\infty}dq \,\frac{N_F(\sqrt{k^2+q^2+2kqx}-\mu)q^2f(k,q,x)}{(k^2+q^2+2kqx)^{3/2}(\omega+i\eta-q-a\...
0
votes
1answer
60 views

Parallelise numerical integral for contour plot

I have the following integral that I would like to evaluate: ...
0
votes
0answers
68 views

Using NDSolve to obtain solution

I am trying to solve the following ordinary differential equation but not getting result. Please help. Thanks My code is ...
1
vote
1answer
60 views

Plotting 90% confidence ellipses for a gaussian pdf with small variances

Mathematica noob here, and I'm having some issues plotting 90% confidence ellipses of a small-variance 2D Gaussian PDF. I have it working perfectly fine for larger covariance matrices, but absolutely ...
0
votes
0answers
42 views

How can I speed up my code finding the parameter which yields zero determinant for increasingly larger matrices?

I build a square matrix with matrix elements dependent on the parameter x. I need to find all values of x within a reasonable ...
0
votes
0answers
37 views

NDSolve::ndsz: At t == -96804.6, step size is effectively zero; singularity or stiff system suspected

I am trying to solve these equations but couldn't figure out how to solve the NDSolve::ndsz error. ...
0
votes
0answers
42 views

Unable to numerically integrate a function I have defined

I am working with a polynomial and wish to integrate over one of it's branch surfaces with high precision. The function is: $$ -z^2 + z^3 + w (-4 z + 3 z^2) + w^3 (-2 + 8 z + 4 z^2 - 4 z^3) + w^2 (-...
2
votes
1answer
117 views

Numerical solution using RK4 to solve nonlinear ODE?

I am trying to use the Runge-Kutta 4 method to solve the nonlinear ODE, using the following Mathematica code: ...
2
votes
4answers
217 views

Integrating a list of values

The data given here data = Table[Clip[Sin[x], {0, 1}], {x, 0, 2 \[Pi], 0.1}] generates the following curve ListPlot[data] ...
1
vote
1answer
69 views

Integrating only over positive values of an oscillating function

I have the following oscillatory function of time (it looks too lengthy!) ...
0
votes
0answers
41 views

How to NIntegrate a result derived from NDSolve?

I have the following code. My requirements are: I want dp at y = h1 for different values of the parameter ...
2
votes
0answers
59 views

Solving 2d non-linear PDE with singular sources numerically [closed]

I would like to hear some suggestions on how to numerically solve a 4d Poisson equation with two singular sources, which can be brought to the following form (thanks to symmetries) \begin{equation} \...
3
votes
3answers
788 views

Solving system of ODEs with extra parameter

I would like to solve a $2\times 2$ system of the form $$\frac{d}{d\theta}T=TA,\quad T(0)=Id$$ where $\theta$ is real and $A$ is of the form $$A=\begin{pmatrix} 0 & \frac{e^{-i \theta}}{\lambda}\\ ...
0
votes
0answers
36 views

How to solve this error in numerical integration?

I am trying to integrate a function numerically and I get an error that I do not understand. The error is : NIntegrate::slwcon : Numerical integration converging too slowly; suspect one of the ...
0
votes
2answers
88 views

Plotting a parametric solution from NDSolve

Im trying to animate multiple points around multiple parametric plots which depicts orbital motion of body around a planet. Initial conditons are; ...
0
votes
0answers
50 views

NDSolve::bvdae error when using NDSolve

I am trying to solve this complex problem. ...
1
vote
1answer
63 views

Why is my integral not being evaluated?

I am trying to integrate a function Gamma, but the output returns the input. I have the following code: ...
8
votes
1answer
423 views

Ways to speed up user implemented RK4

So, I've implemented RK4, and I'm wondering what I can do to make it more efficient? What I've got so far is below. I wish to still record all steps. I think ...
0
votes
1answer
119 views

Plotting elliptical orbits using Verlet method

I'm looking to solve a 2 body system consisting of the Earth and a body of mass in orbit. I'm using the Verlet method to numerically integrate Newton's equation of motion in order to plot an ...
4
votes
2answers
266 views

NIntegrate: How can I solve this integral numerically? NIntegrate fails while Integrate works

I know the exact solution of the principal value of this integral is equal to zero: $\int_{-1}^{1}\int_{-1}^{1}\frac{x^2}{\sqrt{1-x^2}}\frac{\sqrt{1-y^2}}{y-x}dydx=0$ doing: ...
0
votes
1answer
54 views

Complex number as the result of an integral [closed]

My question has been asked before by other members, however, I didn't find the answer to their question helpful in my case. I'm doing a simple numerical integral with real numbers in mathematica, but ...
0
votes
0answers
53 views

Cannot find starting value for variable

I am trying to numerically solve and plot two coupled first-order differential equations using ParametricNDSolve over the region $(0,a)$ where $a$ is the parameter. ...
0
votes
0answers
60 views

Approximate/estimate the ratio of two multidimensional constrained integrals

I have a hypothesis that a certain "qubit-qutrit separability probability" should assume the value $\frac{5}{3} \left(112 \pi ^2-1105\right) \approx 0.659488$. In its initial formulation, this is a ...
2
votes
2answers
132 views

What is the fastest way of doing one integral in Mathematica?

I want to compute the following numerical integral in Mathematica $\int_0^L dy \int_0^y d \bar{y} f(y,\bar{y}),$ where $f(y,\bar{y})$ is a very complicated function. I show my code below where the ...
0
votes
2answers
52 views

Numerically integrate complex valued function of a real variable and a complex variable

I need to numerically integrate a complex valued function of a real variable and a complex variable by the real variable. My integral: $$ \int^1_{-1}\frac{e^{ix}}{x-z}dx ~~~\text{where} ~~x \in \...
2
votes
1answer
67 views

NDSolve solution plugged back into ODE quickly diverges

I have the following ODE with complex $\omega$: $\qquad f(r)\frac{d}{dr}(f(r)\frac{dR}{dr})+(\omega^2-f(r)(\frac{1}{r^2}+\mu^2))R(r)=0,$ and with $f(r)=1-2/r$. I want to solve it starting at $r=2$ ...
2
votes
1answer
67 views

How do I divide an integral into parts and sum the total?

I have an exercise looking like this: Analyze the integral $4\int_{0}^{1} \sqrt{1-x^2} \, \mathrm{d} x$ numerically by deviding the interval ${]0,1[}$ into three equal parts, then summarize the ...
1
vote
1answer
87 views

Conditional evaluation: black hole cross section

I'm trying to calculate the collision cross section of black holes, more precisely, I want the critical impact parameter $b_{\text{crit}}$ for a given initial velocity $v$ such that, at this speed, ...
0
votes
0answers
67 views

Diverging solution to radial equation

I want to solve a seemingly simple eigenvalue problem. I have a fixed set of boundary conditions given and want to change the complex parameter omega in to minimize exponentially falling solutions for ...
3
votes
2answers
95 views

How to solve these ODEs using NDSolve?

I have six odes and I cannot use DSolve. So I tried NDSolve. But it says there may be some errors.The code is such like this: ...
6
votes
1answer
153 views

Maxwell construction problem with FindRoot

A Maxwell construction is just an integral of area and then solving for a root to find vapor pressure. This must be exactly the same value as where the Gibbs energy plot crosses at a point. I found ...