Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

10
votes
0answers
136 views

Strange behaviour of integrals with Cos, Sin, and Exp

During the study of the problem How to solve this integration? I have discovered a strange behaviour of some integrals. I would consider it a bug. ...
7
votes
0answers
616 views

Modelling Hysteresis with a Differential Equation

I want to implement the bulk ferromagnetic hysteresis model (mostly the Jiles-Atherton Model), see http://drum.lib.umd.edu/bitstream/1903/6043/1/PhD_99-1.pdf page 44 equation (30). The needed ...
6
votes
0answers
212 views

Problems with NDSolve for solving coupled Schrödinger-like PDEs with perfectly matched layer boundary condition

I'm trying to solve a full-vectorial wave equation for an arbitrarily shaped wave guide, by using NDSolve and perfectly matched layer (PML) conditions. The PML ...
6
votes
0answers
128 views

Slow NIntegrate over complicated domains (sometimes)

This is no longer a problem with Mathematica 10.* where I can use regions to do the integrations Overview I have a very large matrix I need to calculate where each element requires the integration ...
5
votes
0answers
101 views

Modify NDSolve`StateData (if possible)

I am trying to solve a PDE that needs to be scaled constantly (refer to this). @andre suggests I modify NDSolve`StateData. Now, the problem is, I'm not used to ...
5
votes
0answers
378 views

Increase precision of custom function

I hope the title is not misleading: Suppose I have a function that is quite complicated, e.g. f[u_] := Exp[-Exp[- Abs[c.u]^a] Sin[d.u] Sin[(Abs[c.u]^a) ... I ...
4
votes
0answers
44 views

N[Integrate] failing to return an accurate result from an interpolated integrand

I need to N[Integrate] a function Cos[alpha*x]*f(x) between x=0 and 30 at increasing alpha-values. Here f(x) is an interpolated function derived from a set of 120 ...
4
votes
0answers
60 views

Numerical instabilities of a convection-(non-)diffusion equation when shrinking from a square to a triangular domain

I am trying to evaluate a parameter-dependent indefinite integral using a PDE-based scheme I described here, and I'm having some trouble when I try and cut down the domain from a square to a triangle. ...
4
votes
0answers
67 views

Avoid Evaluation of Function at NDSolve

I have a huge "black-box" f function, which I want to integrate. Let's define it: f[x_,y_,a_]:=a*Exp[-(a*10000)(x^3+y^3)] as ...
4
votes
0answers
101 views

Using indexed array elements as integration dummy variables with EvaluationMonitor. Bug?

As part of a routine that must cope with integration of varying numbers of dimensions, I would like to use indexed variable names (e.g., x[0], x[1],...) as dummy integration variables. However, it ...
4
votes
0answers
87 views

Integrate yields complex value, while after variable transformation the result is real. Bug?

I have the follwoing integral: Integrate[1/Sqrt[0.7 + 0.3*(1 + z)^3], {z, 0, Infinity}, Assumptions -> z \[Element] Reals] >> -3.36354 - 3.85013 I the ...
4
votes
0answers
411 views

Solve integral equation for upper bound

I need to find the upper bound of an integral knowing the value of the lower bound and the result of the integral. Here is my function: ...
4
votes
0answers
69 views

NIntegrate::ncvbr: How should we interpret and handle this error not mentioned in any documentation?

I have some user-defined module describing my integrand which has to be computed numerically (it's much more complicated than this but bear with me): ...
4
votes
0answers
159 views

How to specify the time variable for NDSolve

I recall that it is possible to specify which independent variable is the "time" variable in NDSolve, but I can't find it documented anywhere. Does anyone recall ...
4
votes
0answers
101 views

What are good/best practices to take the Fourier transform of an InterpolatingFunction?

I have a function which I have obtained from numerical integration of a differential equation, and I would like to take its Fourier transform. What are good practices for doing this? To make things ...
3
votes
0answers
67 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: ...
3
votes
0answers
112 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 ...
3
votes
0answers
92 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 ...
3
votes
0answers
124 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. ...
3
votes
0answers
85 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 ...
3
votes
0answers
167 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 ...
3
votes
0answers
126 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 ...
3
votes
0answers
317 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 ...
3
votes
0answers
2k views

Using NDSolve for Integro-Differential Equations

I have a fairly complicated set of coupled non-linear integro-differential equations that I am trying to solve using NDSolve. The equations are: ...
3
votes
0answers
490 views

Numerically solving PDE with high precision

I want to numerically solve the PDE $\partial_t u(t,x)=c\partial_x u(t,x)+(mx-l)u(t,x)$ with some initial and boundary conditions and given parameters $c$, $m$ and $l$. Consider the code ...
3
votes
0answers
244 views

Numerical-Symbolical Integration (Calculus)

I created a simple numeric-symbolic integration. Here you can use symbolical and numerical techniques at the same time. You can also interpolate numerical integrals. The problem with my function is ...
3
votes
0answers
1k views

Solving a system of nonlinear equations self-consistently

I am trying to solve a set of three non-linear equations in Mathematica. I need help with them. The Mathematica code (in plain text format) is attached below. If you copy & paste the code below ...
2
votes
0answers
58 views
2
votes
0answers
58 views

WhenEvent behavior changed from v9 to v10 - how to fix the code?

A couple of years ago I asked a question about solving n-body systems with NDSolve and detecting collisions with WhenEvent. I ...
2
votes
0answers
53 views

Discretised numerical solution to a non-linear non-local equation

I understand that to do something even slightly non-trivial in Mathematica, I need to read some materials; the problem is that there are (too) many materials and only one particular problem, and I ...
2
votes
0answers
61 views

NIntegrate over statistical variables with parameter

Essentially, what I am trying to do is the following: Integrate a function which contains the parameter k ...
2
votes
0answers
109 views

integration of a list of gaussian type orbitals (GTO)

I am currently trying to integrate various components of a current density (j={jx,jy,jz}) over space. The problem is that the current j is extracted from a quantum chemical computation and is a sum of ...
2
votes
0answers
97 views

Nasty integral advice

I have a pretty ferocious integral to solve, and since it doesn't seem I'll be able to do much analytically, I've taken to Mathematica to get some information. Mainly, I want to see if there are any ...
2
votes
0answers
252 views

NDSolve fixed step problem

Working example here: Drive folder (have both files in the same directory! Notice: the line <<variables' in the file seems to throw an error for me, but ...
2
votes
0answers
116 views

Different solutions for seemingly same Integral

I want to evaluate the following integral: $$\int_{\left(1-\sqrt{a}\right)^{2}}^{\left(1+\sqrt{a}\right)^{2}} \frac{1}{2\pi ...
2
votes
0answers
68 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 ...
2
votes
0answers
194 views

Volterra integral equation

I have to find an approximate numerical solution for the equation $$ F(x) - \lambda \int\limits_1^{x} \text{d}s \;s^2 F(s) Z(x-s) = G(x) $$ $$Z(s) = (\psi''(1-2\ h\ i\ s)- 0.5 \psi''(1-2\ h\ i\ s))$$ ...
2
votes
0answers
157 views

Puzzling NDSolve[] behavior for PDE (smooth solution, inconsistent with boundary conditions)

Consider the following: NDSolve[{D[z[x, y], x, x] + D[z[x, y], y, y] == 0, z[x, 0] == Sin[x], z[0, y] == Cos[y]}, z[x, y], x, y] {{z[x, y] -> ...
2
votes
0answers
252 views

NDSolve PDE, not enough boundary condition?

The PDE that I want to solve is: $$ \frac{\partial f}{\partial t} + \frac{1}{m} \left( p_x \frac{\partial f}{\partial x} + p_y \frac{\partial f}{\partial y} + p_z \frac{\partial f}{\partial z} \right) ...
2
votes
0answers
260 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 ...
2
votes
0answers
278 views

Slow integration of interpolating function

I have a large file with irregularly spaced data in the format: ...
2
votes
0answers
78 views

ParametricNDSolve and ProcessEquations

I have a question regarding NDSolve`ProcessEquations and ParametricNDSolve. When using the regular NDSolve we have the option to divide the integration into the three steps ProcessEquations, Iterate ...
2
votes
0answers
129 views

Constrain integration to be over real domain

I am trying to integrate the following: Integrate[(2*Cos[Sqrt[F]*z - G])/E^(D*(p + z)^2), {z, -(h/2), h/2}] I am getting solution in complex domain: ...
2
votes
0answers
146 views

Whether NIntegrate evaluation is multithreaded or not?

About MultiThread evaluation I am talking about here, see this post I am NIntegrate the function grarm[e, 3, dimension, 1, 1, 0.005]. There is matrix operation in ...
2
votes
0answers
2k views

NDSolve: methods and step size choosing

I am looking into the documentation of NDSolve[]; more precisely how this function chooses the StepSize and how it chooses which ...
2
votes
0answers
300 views

Is mathematica storing information it shouldn't store?

I'm seeking to find solutions to a numerical integration with a large set of parameter combinations (basically, I'm doing a brute parameter sampling). Yet, I believe the memory of the computer is ...
2
votes
0answers
408 views

Adapting NDSolve to circumvent NDSolve::bdord: error for 1-D Euler Equations

I attempted to use NDSolve for the 1-D isentropic unsteady flow equations with low subsonic inflow velocity and prescribed inflow total enthalpy; along with a ...
2
votes
0answers
402 views

FindRoot - Speed and errors

I am using FindRoot[] to solve a complicated equation. It seems I get the correct answer even though I get errors about an ...
2
votes
0answers
882 views

Inconsistent boundary and initial conditions: BC ignored altogether

Consider the following diffusion-decay equation with von Neumann b/c in the origin and Dirichlet at the other boundary: ...