Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

5
votes
1answer
256 views

Numerical solution of IVP for linear ODE with variable coefficient runs wild soon

Cross posted in scicomp.SE. A friend of mine showed me this initial value problem (IVP) for a linear ordinary differential equation (ODE) with variable coefficient: $$y''(x)=\left(x^2-1\right) ...
4
votes
2answers
125 views

Coarse-graining in numerical integrations

I have been working recently in a coarse-graining problem I found when using NIntegrate: I am trying to evaluate the function $$f(a)=\int_0^{\infty}x\,e^{-(a^2+b^2)x^2}\text{d}x$$ numerically as a ...
1
vote
2answers
104 views
7
votes
2answers
287 views

Integrating a function over a surface integral

From a first principles bandstructure calculation I get an energy scalar field in three dimensions $E(x,y,z)$. It's now easy to plot a constant energy (contour)-surface for dedicated values ...
2
votes
1answer
75 views

Forcing Exact Outputs for Integrate [closed]

I'm trying to compute the following triple integral: ...
0
votes
0answers
29 views

Roots of two Functions containing integrals, with two parameters [duplicate]

I want to find the values of l1 and l2 from the following two equations: ...
0
votes
1answer
139 views

Time evolution of a wave packet from the time-independent Schroedinger equation [duplicate]

Starting off with the time-independent Schroedinger equation (TISE) $\quad \quad -\frac{\hbar^2}{2m} \nabla^2 \psi + V(r, \theta) \psi = E\, \psi,$ I would like to study the time evolution of an ...
0
votes
0answers
47 views

Integro differential eq boundary difficulties

I'm trying numericaly solve simple integro-differential equation, but have some problems with boundary conditions. System: ...
0
votes
0answers
45 views

What is the right way to combine a Package, Module, ParallelTable and NIntegrate?

I am stuck with a curious problem. I would like to to have a package from which i can call a function test[path], which then performs a time consuming numerical ...
0
votes
1answer
55 views

How can I perform this integration in Mathematica? [closed]

I am new to Mathematica. I want to find the integration of the following expression: $H(f)=T\left(\frac{sin(\pi f T)}{\pi f T}\right)^2$ Here, $T=1.127e-7$ I want to integrate this function for a ...
6
votes
1answer
117 views

Detecting nearly simultaneous WhenEvents in NDSolve

I am trying to solve a system of (many) coupled nonlinear ODEs. I need to decouple some of the equations (i.e. set the time derivatives of some of the dependent variables to zero) at various points in ...
3
votes
1answer
105 views

Evaluating a numerical integration with infinity as limit

I am trying to evaluate a numerical integration (to get an expression of the constant Ω) Suppose that h[x_] := 1/(1 + a x^2) ...
-3
votes
1answer
107 views

How can I evaluate this function in Mathematica? [closed]

I am very new to Mathematica. Today I have got my license. Can someone help me to evaluate the following expression in Mathematica. I want find the values of $P$ for different $n$ $S=129$; ...
0
votes
3answers
77 views

How do I integrate this function?

I am very new to mathematica and also new to this community. I have a problem given below, How to express this in Mathematica? $H=[2,4,10,5,12,34,42,\cdots 12]$ is a vector of size $N$. $h_n$ is the ...
0
votes
2answers
85 views

Fix my code to return a table of values

Here is a “procedural” program that we wrote in my class, implementing the rectangle rule of numerical integration: ...
0
votes
0answers
48 views

Passing integration constants to self defined function

I would like to evaluate an integral I am taking in cylindrical coordinates, in which the integrand contains a previously defined function. I need to pass the r and phi integrand values to this ...
0
votes
2answers
115 views

Numerical 3D Integration in Mathematica [closed]

My question in short is: Is it possible to make numerical 3D integration in mathematica efficiently? Or am I gonna have to move this to C++? I feel this problem is way too trivial to go to C++, so ...
0
votes
0answers
66 views

NIntegrate Polynomial of high degree

I want to integrate a polynomial of degree 100 and higher over a domain that is the intersection of two balls like ...
3
votes
2answers
152 views

Integrate and NIntegrate not the same

Why am I getting two different results here? ...
0
votes
0answers
47 views

Parallel calculation with SetOptions

Is it possible to distribute the effect of SetOptions to parallel kernels? Here is how I encountered the problem: I am trying to calculate a lot of numerical ...
0
votes
0answers
65 views

Stress calculation for stokes equation in 2D

I am solving the Stokes equation for the creeping flow, in a particular geometry, using the stream function formulation. This is my domain: ...
0
votes
1answer
56 views

Difference between NIntegrate and Integrate results

I want to integrate a function of two variables that is defined via a piecewise function. I can compute the integral analytically as follows: ...
1
vote
1answer
264 views

4th-order Runge-Kutta method to solve a system of coupled ODEs [duplicate]

I am a beginner at Mathematica programming and with the Runge-Kutta method as well. I'm trying to solve a system of coupled ODEs using a 4th-order Runge-Kutta method for my project work. I have ...
1
vote
0answers
43 views

Speeding Up the Numerical Integration of a Product of Numerical Integrands with NIntegrate

I need to solve a set of coupled integral equations within a self-consistent cycle. The final result will be functions, say $A(x)$ and $B(x)$, which are related to each other by some integrals which ...
1
vote
1answer
124 views

How to modify a PDE inside NDSolve according to an if condition

I need to solve this PDE $$\partial_tf(t,x)+\partial_xf(t,x)+k\partial_{xx}f(t,x)-xf(t,x)=0 $$ with $k\in\mathbb{R}$ and final condition $f(T,x)=1$ with $0<t<T$. My problem is how to solve ...
2
votes
2answers
253 views

Perturbation theory with Mathematica: Definite integral of polynomial times exponential times hypergeometric function of imaginary argument

I would like to ask also Mathematica users about my question from the math forum. To expand, I'm adding the code which calculates the full double integral for $n=0$ and $\mu=0$ (the second in the ...
1
vote
2answers
74 views

Confusion in Numerical Integration while using FindRoot

I used this code for numerical integration NIntegrate[(x^2 - .0015 x^4)/D[(x^2 - .0015 x^4), x], {x, 1.414, 13}] when upperlimit of x is 13, the integral value ...
1
vote
2answers
134 views

Solving for the limits of an integral

I am trying to get Mathematica to solve for the symmetric limits of an integral of a Square Wave. ...
0
votes
2answers
125 views

Multidimensional Numeric Integration

I can't manage to calculate numerically the following multidimensional integral: ...
0
votes
1answer
124 views

NdSolve problem :NDSolve::ndode: Input is not an ordinary differential equation

I am new to Mathematica. I am working on solving the following different equations numerically written in the code as below. Not so sure about the boundary values that depends on R (M(0)=0, n(1)=0) ...
2
votes
1answer
228 views

(NDSolve) Non-linear 2nd order ODE, regular singular point (looking for good methods for this problem)

I am solving this set of non-linear 2nd order ODE by NDSolve, $$r^2\frac{d^2f}{dr^2} = 2f(1-f)(1-2f)+\frac{r^2}{4}h^2(f-1)$$ $$\frac{d}{dr}\left[r^2\frac{dh}{dr} \right]=2h(1-f)^2+\lambda ...
2
votes
0answers
53 views

Enforcing WorkingPrecision in NIntegrate

I have a very complicated 2D integral that I need to calculate repeatedly, and I'm trying to speed it up a bit, since at the moment it's taking a couple of days to complete. One thing I've noticed is ...
1
vote
2answers
95 views

Simple integration with assumption

I would like to evaluate the following simple expression NIntegrate[Re[Exp[I*Omega*t]], {t, 0, 2 Pi}] for Omega real, but ...
0
votes
0answers
29 views

Solving Couples Integrations with Product

I have a set of four coupled integrated equations given below. I was wondering how to go about solving them; since using NDSolve doesn't help. $d(d)/dv= \sin[i]*\cos[i]* ...
2
votes
2answers
163 views

NIntegrate over a list of functions

This question is the result of these other two questions. Question 1 and 2. I thought it would be better to ask a new question rather than deleting previous one. I think When ...
0
votes
1answer
77 views

Numerical integration and plotting

New to Mathematica, and trying to numerically evaluate two integrals: ...
5
votes
1answer
167 views

Slow exponential evaluation over lists

This question,which is still unanswered, might be relevant because it involves NIntegrate over lists and it also has Exp. In ...
0
votes
0answers
39 views

A problem about NIntegrate the smaller eigenvalue for a matrix

Define a matrix and a function as ...
1
vote
1answer
113 views

Quantum Physics question [closed]

I'm not sure if anyone here would be able to help me. But if you know a more appropriate place where I could ask for help, please let me know. So here's the question: And here's my attempt at ...
1
vote
2answers
108 views

Initial Step Size for NIntegrate

I am using Mathematica to numerically integrate a numerically-defined function (from an interpolation and data). This function has a sequence of somewhat unevenly spaced sharp peaks which dominate ...
1
vote
1answer
178 views

Slow evaluation of NIntegrate when used as a pure function

I asked a perhaps related question here. Here is my code in below. The goal is that to define a function which must be integrated numerically. The function itself first is calculated over different ...
3
votes
1answer
288 views

Numerical integration's speed

Consider this numerical integration of Bessel function: Do[NIntegrate[BesselJ[2, x], {x, 0, 10000}], {i, 1, 100}] // AbsoluteTiming {4.033403, Null} This is ...
6
votes
2answers
195 views

How to force Mathematica to throw an error for NIntegrate

Consider this: NIntegrate[BesselJ[2, x], {x, 0, Infinity}] 0.9999999999904574 This is the correct answer. Now: ...
6
votes
1answer
177 views

Strange Behaviour of NIntegrate

I found some of the values remained unevaluated using the following code Table[NIntegrate[Sin[i x]/((2^x + 1) (Sin[x])), {x, -Pi/2, Pi/2}], {i,70, 90}] Pick them ...
2
votes
2answers
322 views

Wolfram Alpha will calculate this definite integral but Mathematica won't

I'm trying to compute a definite integral of the form $$\int_{0.2}^{0.5} \frac{1}{(1 - y)y^2\sqrt{0.5 - y^2 + y^3}}$$ in Mathematica. WolframAlpha will calculate this but Mathematica only outputs the ...
2
votes
1answer
82 views

WhenEvent error in NDSolve

I’m trying to solve a discontinuous differential equation where there are lost of energy when the trajectory cross the discontinuous manifold. The code I used was ...
0
votes
0answers
42 views

NDSolveValue:dsvar error in a system of non linear differential equations generated using a Table

I have a system of 4 non-linear differential equation, that I generate using Table command. On solving, I keep getting a dsvar error that is not going away. I debugged my code and figured it has to do ...
1
vote
0answers
92 views

Extrapolation of area for a 2D integration

I have a set of points distributed almost uniformly in a certain area of a 2D plane as follow: An example of data points (orange) data = {{0.919443, 1.68921*10^-22}, {0.262277, ...
5
votes
2answers
107 views

Initial time as parameter in ParametricNDSolve

I need a help with the function ParametricNDSolve. My goal is solve the equation \begin{array} &&\dot{x}(t) = y(t) \\ &\dot{y}(t) = x(t)-1-\varepsilon Cos(\omega t) \\ &x(t_0) = x_0\\ ...