Stack Exchange Network

Stack Exchange network consists of 174 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 on the use of numerical functions NIntegrate and NDSolve.

2
votes
1answer
39 views

Implement ListPlot with two (or more) lists, not necessarily of the exact same lengths

I'm computing an integral using two different quasirandom methods. (These correspond to the choice of parameters $\alpha_0= 0,\frac{1}{2}$ in the answer of Martin Roberts to How can one generate an ...
0
votes
2answers
50 views

Using WhenEvent to Change the Sign of a Constant

I am attempting to change the sign of a constant when a certain condition is met during a numerical integration. Here is the code: ...
4
votes
0answers
63 views

DSolve, NDSolve with WhenEvent Give Incorrect Solution for Simple ODE

NDSolve Results On the course of addressing question 181974, I encountered the following problem. ...
1
vote
1answer
119 views

Solving nonlinear ODE with boundary conditions

I am trying to solve the below fucntions using a NDsolve, but I can't get the the converges of them at the certain initial variables.I'm using Mathematica 11.3. I appreciate any help. ...
0
votes
0answers
27 views

Numerical Integration Needs Solution (Inverse Fourier Transform)

I have to solve this integral. How can I do it? ...
4
votes
2answers
96 views

Integrating a bivariate distribution over a region bounded by a straight line

Summary of problem: I'm using Mathematica version 8 to try to integrate the bivariate distribution over a region bounded by a straight line. The two random variables are uncorrelated. When I use ...
5
votes
3answers
100 views

Why Gauss-Legendre Quadrature should keep the number of integral points less than about 50?

I wanted to use Gauss-Legendre Quadrature to calculate an integral as follows: When n=10 and some other number(except odd numbers),the numerical result is the same as theoretical result. ...
3
votes
2answers
33 views

Nesting ParametricNDSolveValue

I have a problem nesting the function ParametricNDSolveValue. The documentation does not help so I hope to find some answers here. A minimalistic example for my problem is: ...
0
votes
0answers
47 views
4
votes
2answers
80 views

NDSolving differential equations with complicated initial conditions

I want to solve numerically the following system of differential equations involving three functions $f[x],g[x],h[x]$ where $x\in \mathbb{R}$ $$ f''[x] -4 g'[x]\,f'[x]=0\\ g''[x]-\lambda\, h'[x]^2=0\\...
3
votes
2answers
102 views

Solving an 'odd' differential equation with NDSolve

I need to solve a differential equation of the type $\qquad \partial_{x_1}y(x_1,x_2)= y(x_1,x_1)\,y(x_1,x_2)$ with initial condition $\qquad y(0,x_2)=x_2$. Now if I try to solve this with NDSolve ...
0
votes
0answers
47 views

integral curves of eigenvectors [closed]

Let us have a symmetric 3x3 tensor field over a 3D manifold and let v be a field of its eigenvectors. I need to calculate its integral curves. The problem is that values of v are given within a grid ...
1
vote
1answer
50 views

How to apply NIntegrate three times

I have following integration. $$I=\int_{0}^{\frac{\pi}{2}} \int_{0}^{\infty} \gamma e^{- \lambda \left(\gamma^2+2d\gamma\cos\theta -d^2 + \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} 2d\cos\Theta(d\cos\...
3
votes
2answers
79 views

Implementing Gauss–Laguerre quadrature for double integral of oscillatory function

I need an efficient way to evaluate a certain double integral for a wide range of parameters: $$I=(\gamma_l \gamma_L )^{3/2} \int_0^\infty \int_0^{1} \frac{r ~d r ~dx}{\sqrt{r^2+b^2 x^2}} \times \\...
1
vote
1answer
53 views

Evaluation of an integral using Mathematica

I am trying to evaluate the following integral, but the result I got is imaginary part. Do you know if there is a way to get a better evaluation of difficult integrals? ...
6
votes
2answers
173 views

Can Mathematica Take Advantage Of a AMD Ryzen Threadripper 2990wx 32 Core Processor?

I have a student version of Mathematica. I'm currently running it on my 8 Core Desktop. On my current Desktop I use it for Numerically integrating expressions 1000s of times, the ParallelTable ...
8
votes
2answers
131 views

Proper use of NDSolve in the context of the reduced 3 body problem

I am currently trying to solve the reduced three body problem in Mathematica. I have the equations of motion $\ddot{x}-2\dot{y}=-\frac{\partial\Omega}{\partial x } $ $\ddot{y}+2\dot{x}=-\frac{\...
1
vote
1answer
74 views

Help to extend this evaluation!

I'm performing a stochastic evaluation, where i'm interested in the assymptotic behavior of the solutions, but my computer can't stand very large times. So I thought that I could evaluate a certain ...
11
votes
1answer
252 views

Speed up NDSolve compared to Python (calls to LSODA)

I migrated a numerical model code from Python to Mathematica and am surprised how much faster the Python version runs. Profiling of the Python version tells me that it is about 100 times faster (120 ...
1
vote
2answers
63 views

Numerical Triple Integration won't evaluate

I am trying to evaluate the following triple integral numerically to no avail: ...
5
votes
1answer
58 views

DiscretePlot Giving Incorrect Answer

I know similar questions have been asked before about bugs in Integrate, but I'm not sure what the particular problem is here (and whether or not there is indeed a bug). When I perform the integral: ...
0
votes
1answer
30 views

Two approaches to a numerical integration give different results. How to determine if this is a result of numerical conditioning?

I am trying to do the following integration $$\int_{ps_1}^{ps_2} \int_{pt_1}^{pt_2} \frac{e^{-k\,r(s,t)}}{r(s,t)}\, ds \, dt$$ Where $r(s,t)$ is the distance between points in two distinct line ...
0
votes
0answers
47 views

Numerical integration gives errors NIntegrate::slwcon: and Integrate::eincr:

I have a problem with numerical integration of this function: ...
0
votes
1answer
55 views

Numerical Integral of a product of Error function and Exponential function

I am trying to evaluate the integral of the expression below. It involves a product of the error function (Erf) and the exponential function (Exp). However, the following error appears and the ...
0
votes
1answer
80 views

Analytical form of the answer of a definite integral

I am trying to find out the analytical form of the answer of the following integration, $$I=\int_0^l r \, dr \int_0^{2\pi} \, d\phi (iks)[ \frac{\exp [ikx_0(N+r^2)^{1/2}]}{[x_0(N+r^2)^{1/2}]}\frac{\...
2
votes
1answer
118 views

Why the NIntegrate give the error “Integrand is not numerical \ at {x,y} =…” ., but at the values {x,y} the integrand can be evaluated?

The integrand includes ku, Sin[x], and Tuu. ku is constant, x is one of the variables, and Tuu is functions of x and y. According to the nice answer of KraZug, I have updated the program. I find ...
0
votes
2answers
62 views

Numerical solution of complicated trigonometric equation

I have the following equation to numerically solve for \[CurlyPhi] as function of $k$ and $x$. $k$ is normally between $-\pi\leq k\leq\pi$. ...
1
vote
1answer
54 views

Integrating a incredibly long expression, whenever I try to use Monte Carlo I got complex answers

I am trying to integrate a recursion relation that is formulated via conformal invariance. The expression if copy and pasted from Mathematica to Word is over 20,000 pages long. Below is an ...
2
votes
2answers
211 views

Solving 2D+1 PDE with Pseudospectral in one direction with periodic boundary condition?

According to the documentation about the pseudospectral difference-order: It says: Following the discussion here: I found the messy behavior is always on the artificial boundary in $\omega$-...
0
votes
1answer
47 views

How can I plot the solutions to this system of non linear ODEs?

I need to solve the following system: $$\left\{ \begin{array} { l l } { (u')^2 + (v')^2 = 1 } \\ {u'v'' - u''v' = uu' + vv' } \end{array} \right.$$ and it's a task that's proven to be quite hard by ...
0
votes
1answer
27 views

Integrating a vector according to elements of another vector

I have two vectors, $\bar{x},\bar{v}$ and I want to produce a third vector such that:$$ u_i = \int_{x_i}^{x_i+\delta} f(v_i,t)dt \ .$$ I tried (with a simple function for example): ...
1
vote
0answers
53 views

NDSolve for a system of PDEs with piecewise coefficients

I want to solve a system of 3 second order linear PDEs with homogeneous Dirichlet boundary conditions. The code I use is as follows: ...
1
vote
1answer
69 views

Numerical Integration with Inequality Condition [closed]

I need to solve the following definite integral: $$\int_0^1 \mathrm{d}s \int_0^{2\pi} \mathrm{d}\phi \int_0^{2\pi} \mathrm{d}\phi' \int \mathrm{d}\theta\,'\sin{\theta\,'} \text{,}$$ such that $$\...
2
votes
2answers
44 views

Display form for numerical integration (like `\[Esc] dintt \[Esc]`)?

When I use the alias \[Esc] dintt \[Esc] to pretty print a definite integral in my notebook, it actually stands for ...
2
votes
1answer
71 views

Numerical solution of 3 dim integral with singularity

I want to solve the following integral numerically with Mathematica: $\int_{0}^{L_x}\int_{0}^{L_y}\int_{0}^{L_z}d^3x'\frac{\sin^2(\frac{x'\pi}{L_x})\sin^2(\frac{y'\pi}{L_y})\sin^2(\frac{z'\pi}{L_z})}{...
0
votes
0answers
44 views

How to set the precision of the integral variable

Gdu is an integration with variables x and y. Tdu is a part of the integrand which should be generated through ndu. I found that for some x and y, e.g.x=0.001,y=0, they must be SetPrecision (x=...
2
votes
1answer
72 views

How would one go about plotting this parameterized curve using numerical resources (analitically it's too hard)?

I'm working with the system of differential equations: $$\begin{align*} \left\{ \begin{array} { l l } { (u')^2 + (v')^2 = 1 } \\ {u'v'' - u''v' = -v' + u' } \end{array} \right. \end{align*}$$ Where $...
2
votes
1answer
70 views
2
votes
1answer
100 views

4D NIntegrate with singularities

I need to integrate a function in a 4D region (x1,y1,x2,y2), which explodes whenever x1=x2&&y1=y2. The code is as following: ...
-3
votes
1answer
118 views

Why the NIntegrate can not give a result?

The integrand includes ku, Sin[x], and Tuu. ku is constant, x is one of the variables, and Tuu is functions of x. I have tested that when x and y are given, Tuu can be carried out. But why NIntegrate[...
1
vote
1answer
69 views

Coloring Points in a DensityPlot/ListDensityPlot

I have a PDE system, whose functions are $a=a(t, x, y)$, $b=b(t,x,y)$, and $c=c(t,x,y)$, with Dirichlet null boundary conditions and initial conditions in the form of circle. The respective code ...
0
votes
1answer
53 views

Problem solving BVP using NDsolve

I'm trying to solve an eigth-order linear ODE using NDsolve. The Code I'm using is: ...
1
vote
1answer
66 views

Integral of modified Bessel function is wrong

A simple integration of a modified Bessel function gives: ...
0
votes
2answers
44 views

NIntegrate numerical accuracy and errors

I have the following 3x3 matrix M = {{-I*ω + Γ/2, I*g1, 0}, {I*g1, -I*ω + κ1/2, I*g2}, {0, I*g2, -I*ω + κ2/2}}; Finding the eigenvalues and eigenvectors ...
2
votes
1answer
35 views

Question regarding NIntegrate using the Arg function

I am having some trouble when trying to evaluate this simple integral using NIntegrate: ...
1
vote
1answer
181 views

Solving Integro-differential equation numerically with shooting method

This question is related a question I previously asked here Solving integro-differential equation with boundary condition at infinity and for which a solution was found . Now I am dealing with a ...
3
votes
2answers
138 views

Increase Performance of WhenEvent in NDSolve

I'm trying to reset the value of functions $u_{i}$ when they reach a threshold $θ$. Below the threshold, they evolve according to a simple differential equation. The $r_{i}$ resets the derivative to ...
1
vote
1answer
78 views

Highly oscillating integral

I am trying to integrate a highly oscillatory integral. the integrand is a function of 4 variables: f1, f2, x2, y the integrand is ...
0
votes
2answers
126 views

Nonlinear model fit with Numerical integration

I'm having trouble writing a Nonlinear Model fit where the model is a numerical integral evaluated with NIntegrate. I have read other questions and answers about more or less the same problem, but for ...