# Tagged Questions

Questions on the use of numerical functions NIntegrate and NDSolve.

504 views

### NIntegrate giving message NIntegrate::slwcon:

I got this interesting answer from Mathematica when trying to integrate my function numerically: f[x_] := Sqrt[17*x^2 + x^4] NIntegrate[f[x], {x, -1, 2}] ...
186 views

### NDSolve break condition

I'm solving a differential equation numerically by NDSolve[{p'[r] == -function[r,p[r]], p[0] == pcenter}, p,{r, 0, rmax}] with function>0. At some r, p[r] ...
948 views

### NDSolve: Normalizing at every step

Suppose I have an transport equation with an initial conditions: ...
54 views

### NDSolve Step Size Effectively Zero

I'm trying to solve a PDE for a function of 2 variables. The most accurate parameterizations of this equation are very unwieldy and involve numerous piecewise elements, and so right now I'm trying to ...
95 views

### Trying to find a temperature profile with a nonlinear 2nd order ODE. NDSolve very sensitive to seemingly arbitrary constant

I am trying to solve this differential equation for a heat transfer problem: kt\frac{\partial^2 T}{\partial x^2} = \epsilon \sigma T^4, \ \ \ T(0) = T_0, \ \ \ \frac{\partial T}{\...
124 views

### Meniscus outside of a cylinder - axisymmetric Young-Laplace equation in semi-infinite domain

How to solve the axisymmetric Young-Laplace equation $$\frac{z'(r)}{r \sqrt{z'(r)^2+1}}+\frac{z''(r)}{\left(z'(r)^2+1\right)^{3/2}}=z(r)$$ with b.c.s $$z'(1)=-2$$$$z'(\infty)=0$$ where $z=Z/l_c$ ...
247 views

### Backward in time numerical integration with fixed time step

Consider simple use of NDSolve[] function used to solve an ODE backward in time ...
100 views

### In NMinimize, how can I efficiently handle NIntegrate errors for non-integrable functions?

I am using NMinimize to find parameters that minimise the integral of a function in the least squares sense: ...
243 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) ...
301 views

### Approximate $h$ in $F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$

Consider $$F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$$ $$|z|\le L$$ $$0 \le \theta \le \pi$$ By having knowledge of $F(\theta)$, how can one approximate $h(z)$? In ...
162 views

### WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
122 views

### Strange integration

Bug introduced in 9.0 or earlier and fixed in 10.1 Note: Beginning with V10.1, this integral returns unevaluated but without error messages. I tried to evaluate this line ...
303 views

### Integrate equations of motion when force depends on position

I'm fairly new to Mathematica. I'm trying to test my C++ implementation of a fourth order Runge Kutta method for Newton's equations of motion. I want to test my integrator when the applied force is ...
641 views

### Limitations of ParametricNDSolve family w.r.t objective functions

Observation: I can see even for very simple modification in case of an scalar objective involving an definite integral in time ParametricNDSolve fails. Here is an ...
1k views

### NDSolve for a large system of simple ODEs

I am solving a system of many (more than 100) ODEs. It is the kind of standard rate equation encountered in semiconductor physics. Here is the system: ...
532 views

### How to set the initial condition? (to make IC and BC consistent)

I want to find the initial condition which fits mixed boundary condition of Phi[r, Theta, t]. The original initial condition in text is Phi[r, Theta, 0] == 1 . ...
72 views

### Convergence of a multiple numerical integration

I would like to define the following function $F(A,\nu)$, which is the result of a numerical integration, and needs the following function definitions. ...
99 views

### NDSolve DAE solution order is mixed up

Bug in 10.4.0.0, probably introduced earlier. Compare the two solution sets below: in the first one (x == False), there are only 3 dependent variables while in ...
63 views

### How can I plot points generated by a Verlet Integration?

So, I have this code for Verlet Integration: ...
104 views

### Want NIntegrate to catch error message

Really stuck with this. When I use NIntegrate, it sometimes prints a message like NIntegrate::ncvb: "NIntegrate failed to converge to prescribed accuracy ...
181 views

### NIntegrate and Interval regions

NIntegrate does not seem to like Intervals as regions. Consider the following example function defined for a parameter "a" ...
361 views

### Surface area of intersecting spheres

Given a sphere of radius 1 centered at the origin and $n$ spheres with radii $r_i$ centered at predefined coordinates, $c_i$, in space, I am after the surface area of the unit sphere that is not ...
844 views

### Question on accuracy and precision of NIntegrate

As a Mathematica newbie, I was testing the accuracy/precision of NIntegrate (9.0.1.0 on Mac) and have obtained a very peculiar result. ...
302 views

### NDSolve: Reinitialize fails with If condition

I have found a weird problem using If conditions containing an state inequality of the form state<=. First consider the simple ODE with an If condition ...
2k views

### NDSolve does not respond

For some sets of constants, NDSolve gives me true solutions, but when I try for example, T = 1/(2*2200), Mathematica does not respond. What can I do? The code below ...
490 views

### NIntegrate inside NSum

Consider the following function with a numerical integration: ...
109 views

### failure of code with Helmholtz equation with point source

I am new to the finite elements package in Mathematica. I have a system of equations, one of which is a Helmholtz equation with a point source in the interior of a bounded domain. The following is the ...
71 views

### Numerical integration with parameter and plot

I'm working on this function: (0.0027 Sin[phi])/(1.05*Exp[-241w]+ Exp[239w]-Cos[phi]) I'd want NIntegrate this function on <...
214 views

### List interpolation

Hi mathematica people! So i am looking for the best way to interpolate a function given a list of its values. I have an iterative algorithm which needs high precision otherwise the numerical noise is ...
190 views

### NIntegrate returns zero for non zero integrand, 4d Integration

I am trying to calculate the following integral. ...
2k views

### Can Mathematica solve integro-differential equations?

I have integro-differential equations like this: ...
729 views

### How to adjust parameters to experimental data on a NDSolve problem

I have 2 differential equations with 2 variables, x and y,which are a function of t and I have the parameters k1, k2 y k3. ...
542 views

### Second Order Non Linear Differential Equation

I'm trying to solve the following differential equation numerically: ...
79 views

### Integrate function over a 2D implicit surface

I have the following problem. Let's say we have a 2D region, let me be very explicit: ...
121 views

### Mathematica Newmark Optimization

Here is my Mathematica code which implements the Newmark method to solve a equation of motion. The variable "ag" contains the accelerations from an earthquake record. Is it possible to optimize this ...
56 views

### Singularity treatment in a simple problem [duplicate]

With a simple search, several posts can be found on treating singularities encountered while using NDSolvefamily of numerical methods. However, most of them involve ...
112 views

### Implementing the Numerov method for solving ODEs with NDSolve

I'd like to implement the Numerov scheme for solving an ODE (Scroedinger Eq time-independent) with NDSolve. I tried in analogy with the Runge Kutta example in the ...
128 views

### NSolve doesn't work on an equation containing a numerical integral and constraints

I'm having trouble getting Mathematica to solve equations numerically. I know that its important to specify the type of variables for pattern testing (see e.g. here) but this doesn't seem to work. ...
91 views

### What am I missing in this highly oscillatory integral?

I want to numerically integrate this equation (in python without calling Mathematica): $\int_0^\infty {\rm d}k f(k) J_v(r k) J_n(s k)$ where $f(k)$ is a non-smooth function, $J_v$ are the Bessel ...
361 views

### Problem solving a nonlinear partial differential diffusion equation [closed]

EDIT: actualy the nonlinear partial differential equations for interacting density distributions, including boundary conditions, should be given as  \frac{\partial\phi}{\partial t} = D \frac{\...
171 views

### Numerical integration: complicated 2D integral seems to be poorly estimated

In the course of some physics research I've been working on, a very annoying integral has appeared that I'm having difficulty evaluating numerically. Any help you could offer would be greatly ...
136 views

### Nested NIntegrate of vector function

I am trying to perform a nested integration where the upper limit of the inner integral depends on the value of the outer integral, like in this question: Nested NIntegrate. Just like the linked ...
321 views

### Function with a sharp resonance which Mathematica fails to integrate. Why?

I'm a new user of Mathematica and I'm trying to use it to calculate the collisional cross-section as a function of energy for a given potential and decay rate. I know that the resulting function ...
285 views

### Global vs local adaptive integration: lattice propagator

I was doing the first exercise in the paper Lattice QCD for Novices. This is the expected result: With the default "GlobalAdaptive" method for NIntegrate it threw errors saying that the error had ...