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 tagged [numerical-integration]

Questions on the use of numerical functions NIntegrate and NDSolve.

0
votes
0answers
40 views

Interpreting Mathematica code on black holes

I am trying to understand the code written down on page 7 of this document (code is in Mathematica) I understand pretty much all of the code on the previous page needed to setup the page 7 code (...
0
votes
1answer
37 views

Using NIntegrate over 1 variable to find function of 2 variables

I'm attempting to numerically solve the following in order to get a function of 2 variables, just looking at the real part of $$\psi(x,t)=\frac{1}{\pi\sqrt{2}}\int_{-100}^{100}\frac{\sin{(k)}}{k}e^{i\...
0
votes
0answers
71 views

Solving a differo-integral equation [duplicate]

I've the following equation for x(t): $$x'(t)\cdot\text{a}+\text{b}\cdot\frac{x'(t)}{x(t)+\text{c}}+\frac{\partial}{\partial t}\left\{\int_0^tx(\tau)\cdot\mathcal{...
0
votes
1answer
35 views

RegionPlot evaluating NIntegrate before assigning variable values and resulting in non-numerical integrands [duplicate]

I am trying to find the regions where the integral of a function a function is larger than a certain quantity using RegionPlot. For simplicity's sake, let's say the intergal I am looking to plot is is ...
3
votes
2answers
137 views

Solution or artifact?

I am trying to increase the precision of the code ...
0
votes
0answers
50 views

Non-autonomous ODE use NDSolve, error: Step Size is effectively zero; singularity or stiff system is suspected

I have seen this error NDSolve::ndsz many times when I use NDSolve to get the solution of a non-autonomous ODE. I try but all ...
0
votes
0answers
51 views

Nested Cauchy type integration

I have a function which is in integral form: $$f_+(z)=\exp\bigg(\frac{1}{2\pi i}\oint_{C}\frac{f(\alpha)}{(z-\alpha)}\,d\alpha\bigg),$$ where $C$ is a unit circle. I want to take the Fourier ...
5
votes
2answers
133 views

Does Mathematica gives us a wrong result for the integral of a function including elliptic functions?

Calculus tells us that the differentiation of the integral of a function should be itself, but at least in one case Mathematica answers NO. I feel very confused. The new figure seems to bifurcate at ...
0
votes
0answers
75 views
0
votes
0answers
32 views

Numerical solution to approximate the singular integration using collocation method

I am working to solve "numerically" the following integral equation IE: u[x]=f[x]+Integrate[(1/(x-t)^(1/4))*u[t],{t,0,x}]+Integrate[(1/(x-t)^(1/4))*u[t],{t,0,1}] ...
0
votes
0answers
39 views

Non-numerical values errors as NIntegrate

Here is my code: 1. Define a Gaussian Mixture Model ...
0
votes
1answer
22 views

Integrate a product of functions with random variables

Assume there is a function f($x_1$,...$x_n$,$Y$) and I seek for the integral following on an area $[0,1]^m$: where $Y_i$ are the parameter I generate randomly for each function. The total number of ...
3
votes
1answer
100 views

Complex first-order differential equation

I have a differential equation $\frac{dx}{dt} = \sqrt{1+x^4}$ $x$ is a complex variable. I want to solve it for some given initial condition, and plot the solution (real part vs. imaginary part). ...
1
vote
3answers
63 views

Numerical integration converging too slowly. how to over come this

I have a function U1 which contains a linear combination of trigonometric function, I wanted to Numerically integrate this function U1. Since each trigonometric functions associated with some unknown ...
3
votes
1answer
135 views
0
votes
1answer
35 views

Table in NIntegrate

I have an integral that I want to evaluate it once and store its values in a table so that I don't run the integration each time that I want to plot it. Its form is ...
0
votes
1answer
39 views

Trapezoid rule-esque integration with unevenly spaced n-D grid

I have a function (or rather many functions) defined over an n-dimensional grid. The grid points will often but not always be evenly spaced. I want to compute integrals of these functions numerically. ...
0
votes
0answers
40 views

Problem with NDSolve::ndnum error when trying to solve a system of differential equation

I get the error reported as NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.` when trying to run the following code: ...
7
votes
5answers
232 views

Functional fixed points (ie fixed point of mapping from function space C[0,1] to itself)

I am looking for some tips or guidance as to what machinery in mathematica can help me get at this problem numerically. I am looking for fixed points of a mapping, but the objects in question are ...
0
votes
1answer
26 views

NIntegration and Exclusions

I am attempting to integrate a long function by the MonteCarlo method. The code yields an answer as I've programmed the function, but when I try to define a region of exclusion, I get an error ...
0
votes
2answers
54 views

Specifying history for delay differential equations ``near infinity'' (using NDSolve)

Consider the following DDE: $ f''(x)+ f(x+ 1) = 0.$ For $ x \gg 1$, this DDE should approximately reduce to that of a simple harmonic oscillator: $f''(x)+f(x) \approx 0$. Suppose that for some ...
1
vote
1answer
62 views

Implementing a function so it accepts functions, function names and expressions as an argument

I'm trying to write a Mathematica function which takes an arbitrary expression as input. More concretely, I'm trying to write an integration function (utilizing the trapezoidal method), the input of ...
1
vote
2answers
158 views

A numerical boundary conditions paradox

For $(t,z)\in[0,1]\times[-1,0]$ zmin = -1; tmax = 1; and some fields $w(t,z)$ and $y(t,z)$ ...
1
vote
1answer
29 views

NIntegrate fails with functions that have (necessarily) numeric lists as arguments

I'm not able to NIntegrate a function that has a numeric list as an argument. My original problem involves a compiled function, but a MWE is the following: ...
9
votes
1answer
160 views

FiniteElement v.s. TensorProductGrid: which is reliable for Schrödinger equation with periodic b.c.?

This is a problem comes up in the discussion under this post and I think it's worth starting a new question for it. I suspect the underlying issue is the same as in this post, but not sure. Consider ...
1
vote
1answer
86 views

NDSolve: method of lines: unexpected error: insufficient boundary conditions

As a test of my ability to master the Method of Lines I tried to NDSolve the PDE's system $$\partial_t \varphi = \varpi\qquad\partial_t\varpi=\frac{1}{r}\partial^...
0
votes
1answer
38 views

NIntegrate error message: “The integrand…has evaluated to non-numerical values for all sampling points in the region with boundaries…”

I am trying to solve the following problem in Mathematica. However, the problem is that R0 is an equation itself, an integral, to be more specific. So I always get the above error message. An ...
1
vote
2answers
175 views

Time-dependent Schrödinger equation and density plot

I'm interested in the density plot of the solution of a 1D time-dependent Schrödinger equation with a given potential. So I have: ...
3
votes
2answers
117 views

A complicated use of NDSolve

I am looking for a particular type of plots. OK, let me explain, Here is my DE (I don't know what to call it), where, $\frac{\partial p}{\partial r} =0$, $r_1=\epsilon$, $r_2=1+\phi\cos(2\pi z)$. ...
1
vote
0answers
72 views

Fourier Transform of streched exponential

I need to compute the Fourier Transform of a streched exponential (according to Wikipedia "it must be calculated either by numeric integration, or from a series expansion"; so I go for the first ...
4
votes
2answers
68 views

Why do I get “PrincipalValue cannot work with the specified exclusions” when feeding a list to a function? [closed]

I have the following test function which I want to evaluate at various points from $x=0$ to $5$: $f(x) = \int^{20}_{1}\frac{1}{x-y} dy$ There's clearly a singularity here in the integral at $x=y$, ...
5
votes
1answer
81 views

Loss of accuracy in orthogonalisation of polynomials using Orthogonalize

Context As a mean to understand the growth of structure in the universe, I am interested in characterising the curvature of random fields such as this one: For this purpose I start with a PDF of the ...
1
vote
1answer
73 views

fast sum computation

I would like to compute sum. How is it possible to compute the sum fast? May be with the help of replacing Sum with NSum or <...
0
votes
0answers
37 views

NIntegrate weird behaviour inside a function

I wrote this little function ...
0
votes
1answer
40 views

NIntegrate: The integrand has evaluated to non-numerical values for all sampling points in the region with boundaries {}{}

I encountered a problem with the NIntegrate function while simulating a physical situation. The expression is quite messy, but it is just an integration over a polynomial so it should be possible. I ...
0
votes
0answers
22 views

variable outputs and errors from NIntegrate with same values

I'm using NIntegrate to perform numerous integrations with the value L. L is utilized in multiple functions, all of which are called by NIntegrate to run. ...
0
votes
1answer
59 views

Numerically integrate over an Interpolating function [closed]

I would like to integrate over an interpolating function, which itself is the output of NDSolve in the following code. Unfortunately, I get an error code, saying ...
4
votes
1answer
227 views

Dynamic, nonlinear, damped Euler–Bernoulli beam equation

I would like to solve the 3 coupled PDEs describing a damped, nonlinear (i.e displacements in the $x$ direction along the beam need to be considered along with the $y$ displacements normally ...
0
votes
1answer
30 views

PDE's numerical integration: simplify output: get rid of $[t,r]$'s and ${}^{(0,1)}$'s

When numerically integrating PDE's systems mathematica output can be chaotic and therfore time-consuming or even impossible to understand and use. A major source of confusion are the $[t,r]$'s and ${...
0
votes
0answers
15 views

NDSolve: Method of Lines: same grids for spatial discretization: error: stiff system_zero step size

How can I modify bbgofrey's answer so as to use $n+1$ grid points for variable $y$? My code ...
1
vote
2answers
51 views

Numerics & List Manipulation:ListCorrelate: yield $\{-f1 + f2, \dots, -f2 + f4, \dots\}$ from $\{f1, f2, f3, f4, f5\}$

The command ListCorrelate[{-1, 1}, {f1, f2, f3, f4, f5}] yields {-f1 + f2, -f2 + f3, -f3 + f4, -f4 + f5} is there any simple way to get {-f1 + f2, -f1 + ...
2
votes
0answers
49 views

Integrating over colors

I'm trying to compute the following integral: $$\int_{380 \, \mathrm{nm}}^{700 \, \mathrm{nm}}\mathbf{RGB}(\mathrm{Hue}(\lambda))\frac{\mathrm{d}\lambda}{\lambda^4}$$ where $\mathbf{RBG}$ takes in ...
2
votes
2answers
188 views

Help for Solving Two Equations For Two Unknows (from a Paper)

I am trying to reproduce numerically the results found in this paper: https://ieeexplore.ieee.org/document/1707778 You don't necessarily need to read it. Basically I boils down to solving a two ...
2
votes
1answer
100 views

Symbolic integration of Exponential

How can I solve this integration? I want to solve this integration with c, B, H, Y, b, w surviving as constants in the result: ...
3
votes
1answer
141 views

Eigenvalues of a non-Hermitian complex periodic potential

I have an eigenvalue problem: $$-\frac{d^2}{dx^2} \psi(x) +V(x)\psi(x) = E \psi(x)$$ where $V(x)$ is a complex periodic potential: $$V(x) = 4[\cos^2(x) + i 0.3 \sin(2x)]$$ It has been claimed that ...
1
vote
2answers
63 views

Error Message NIntegrate: “The integrand … has evaluated to non-numerical values…”

When running the following code, I get the error message that "The integrand ... has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,0.0695171}}". Can ...
0
votes
0answers
46 views

NDSolve:Method of Lines: Spatial Discretization: bother doing it explicitly or just implement as internal routine?

My question is whether one's code must always contain the actual description of spatial discretization written explicitly or whether the Method of Lines can be called as an internal routine. If so ...
3
votes
2answers
100 views

Issues With WhenEvent in PDEs

I am trying to solve the PDE below: ...
11
votes
1answer
300 views

Symbolic integration of potential over a disc : branch cut problem?

Context I am trying to explore the geometry of a crystal made of irregular bubbles. See animation here. very vaguely in the spirit of this post (it is in fact motivated by cosmology and galaxy ...