Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

2
votes
1answer
70 views

gaussian integration

I'm new on Mathematica and I am an engeneer with only a little base of numerical computation. I have to integrate a trigonometrical function numerically with a Gauss integration. The function is: ...
0
votes
0answers
38 views

NDSolve : Solve a single variable-coefficient ODE as series of constant-coefficient ODEs

I have a manipulator equation of the form: $M(q){q''} + C(q,q')q'+G(q) = {0}$ where $M, C$ are $6$ x $6$ matrices, and $G, q$ are $6$ x $1$ vectors and $q$ a function of time. ...
6
votes
2answers
153 views

Reject diverging solution of NDSolve

I'm trying to numerically simulate a spring system with complex stiffness. In essence systems of the form $x''(t)+ (a+ ib) x(t)=0$ For this simple example an analytic solution is easy to find. The ...
2
votes
1answer
79 views

Error accumulation in NDSolve?

I'm trying to solve this system of ODEs numerically: $$\vec{Q} = \vec{P} \times \vec{Q}$$ where vectors $\vec{P}, \vec{Q}$ have 3 components: $$\vec{Q} = \left( Q_1, Q_2, Q_3 \right) $$ $$\vec{P} = ...
6
votes
0answers
105 views
+50

NMinimize with NIntegrate (crash in symbolic evaluation, memory leak)

This is a "common" problem from what I've seen, but with a different spin. I have a function I use often that finds a fit of an expression to another expression with some free parameters (e.g. for ...
3
votes
3answers
193 views
4
votes
1answer
61 views

WhenEvent used in a PDE to output independent variable

I want to use WhenEvent with a PDE after it has reached steady state. I'm posting a system of 2 equations (my real system has 6) and I'm solving the advection-diffusion-reaction 2nd order PDE. First ...
10
votes
2answers
202 views

How to use NDSolve with discontinuities at internal boundaries?

I don’t know how to impose discontinuous internal boundary conditions (BCs) in NDSolve, so I’ve set up an example problem to illustrate my issue. Consider the simple first-order ODE for $f(z)$ on the ...
2
votes
2answers
95 views

How should I tweak the options in NIntegrate?

I'm trying to obtain an accurate result from a difficult-to-integrate function and I've thrown in the kitchen sink worth of options in NIntegrate. I think I'm ...
0
votes
1answer
61 views

Calculation Performance (slow Plotting)

I have a functions, which is an Integral. It is exaclty this function Zf[x_] := 2*I*NIntegrate[Exp[-y^2.0 + 2.0*I*y*x], {y, 0, Infinity}]; Later I need to plot a ...
0
votes
0answers
37 views

How to get this numerical solution of a integro-differential equation [migrated]

Previously, I ask an NDSolve questions(How to solve the differential equation with Duhamel's integral?), but now a more sophisticated one: ...
2
votes
1answer
42 views

Integrate and NIntegrate combined, giving MaxPrecision error

I am trying to integrate the following : ...
12
votes
1answer
234 views

How do I create a triangulated surface from points?

I have a set of points in a nx3 matrix and I would like to convert them into a surface, so that I may calculate its surface area. The function ListSurfacePlot3D creates the surface how I want it. ...
-2
votes
1answer
37 views

NIntegrate a function containing NDSolve

I am having an issue integrating a function for which I am getting values for when I evaluate it. ...
1
vote
1answer
91 views

How do I solve this ODE numerically in Mathematica?

I want to solve these equations numerically in Mathematica and plot them. \begin{equation} u'(t)=1.5\,u(t)\,v(t)-u(t) \space \space \space \text{and} \space \space u(0)=0.001 \end{equation} ...
2
votes
0answers
87 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 ...
0
votes
0answers
60 views

Finding when a ODE returns to starting position

I am trying to discover when these ODE return to their start position. I am using coordinates that have a periodicity of {Pi/2, 2Pi, 2Pi}. To accomplish this I have had to use mod. The ODE are ...
0
votes
0answers
96 views

How to optimize a cost function which involve the solution of a ODE system using the NMinmize?

I have created a cost function, the value of which depends on the solution of a ODE (ordinary differential equation). The parameters of the ODE are not determined, and my goal is to determine them ...
0
votes
0answers
89 views

Integrating a highly oscillatory function

I am trying to numerically evaluate the integral $\int_{-\pi}^{\pi}\mathrm{d}x f(x) \mathrm{e}^{\mathrm{i} xn}$, where $n$ is a large number, say 50. The errors I get are NIntegrate::slwcon and ...
0
votes
0answers
58 views

Improve the speed of Gaussian quadrature integration

I am using Gaussian quadrature method to do numerical integration for a function Pderivative, which is related to the demagnetization tensor of ...
0
votes
1answer
73 views

Performing piecewise integration

The premise is that I am a new Mathematica user. I'm trying to evaluate the following ...
5
votes
1answer
86 views

Why does DSolve give a different result than NDSolve?

When I try DSolve to solve a system: ...
0
votes
1answer
78 views

Numerical integration converging too slowly

I must solve this integral which I suppose to be a very small number. How can I do? When I wrote this code: ...
7
votes
3answers
200 views

NIntegrate of surface area of intersecting spheres yields zero

I have a bunch of spheres (it's actually diamond cubic structure. The 0.6 radius doesn't matter), ...
0
votes
0answers
47 views

NIntegrate unexpectedly returns complex number

I am attempting to visualise the effect of shift parameter $\gamma$ on the 3-parameter log-normal distribution. $$pdf(x;\mu,\sigma,\gamma) = ...
2
votes
0answers
47 views

Better to have infinities in limits or integrands (`NIntegrate`)? [closed]

I'm using ListPlot to plot the integral of a function with respect of the function's second variable: ...
0
votes
0answers
28 views

Does a very large prefactor affect NIntegration time when plotting the result?

I'm using ListPlot[ NIntegrate[f[x,#],{x,a,b}]&/@Range[10,100] ] to plot the integral of the two variable function f as a ...
2
votes
1answer
88 views

Numerically integrate and plot $f(x;p)$ for a range of the parameter $p$

Suppose we have an integral of the form $$I = \int_a^b dx \, \sin(px), \tag{1}$$ where I've take $f(x;p) = \sin (px)$ to be specific. I want to plot this integral for a range of values of the ...
3
votes
2answers
117 views

How much time should one give Mathematica for an integral evaluation?

Sometimes when I do integrals in Mathematica (M), it keeps thinking and thinking and I have no idea what is going on inside M. For how long should one wait or how does one know whether M has not got ...
1
vote
0answers
35 views

Which type of integrals are better for Mathematica [closed]

Is it in general better to type in a integral with its limits, or is it better to type an indefinite integral into Mathematica? With better I mean: Likelihood that Mathematica can solve it, ...
0
votes
0answers
38 views

Improve speed in module with NIntegrate and FindRoots

I am running version 10.1 in Windows 7. The following code gives good results but I have two questions: Is there a way to speed up the program as I would like to compute more data points? The code ...
0
votes
1answer
78 views

Integral evaluation error

I have the following integral that I wish to evaluate using Mathematica: ...
0
votes
0answers
8 views

Numerical Integration with no lower limit [migrated]

Is there any 'natural' way to evaluate an integral numerically with a variable upper limit only? Actually I want to calculate the following residue $$\text{Residue}\left[\frac{z^3}{1-\pi ^4 z^4}\int ...
2
votes
2answers
86 views

Calculate area between two multivalued curves

I have to calculate the area between two curves which will give me the result of a particular quantity. However, both the curves are multivalued functions. Here is a data set showing the region where ...
0
votes
0answers
50 views

Problem with plotting a piecewise function [duplicate]

I'm having a very puzzling issue with piecewise defined but smoothly continuous functions. I have a perfectly continuous piecewise function defined as ...
11
votes
6answers
727 views

Integrate gives wrong results

Integrate[a/(Sin[t]^2 + a^2), {t, 0, 2 Pi}] $$\int_0^{2 \pi } \frac{a}{a^2+\sin ^2(t)} \, dt$$ gives $0$ This cannot be true. What is going on? If I insert a ...
7
votes
2answers
265 views

How to solve the differential equation with Duhamel's integral?

How do I solve a differential equation with Duhamel's integral? I tried to solve it with NDSolve, but failed: ...
1
vote
1answer
62 views

Assymptotically Solving ODE with free parameters

I have a first order ODE, $F(y[x], y'[x], A, B) = 0$. I want to solve this numerically (with the boundary value $y[1] = i$ ) but also with the following requirements: A and B are free parameters which ...
0
votes
0answers
38 views

NIntegrate fails to converge around a value out of integration range

This is the function that I am trying to integrate, I have interpolated it for best results (would rather not): There is a 'singularity' around 0, but I get the warnings and bad results even when ...
0
votes
0answers
38 views

Integration problem: lrgexp

I want to calculate the following integration but it gives the error PolynomialGCD::lrgexp: Exponent is out of bounds for function PolynomialGCD. The code is: ...
1
vote
2answers
70 views

Plotting NIntegrate

Plot[E^(-0.5 x) NIntegrate[Cos[t] E^(Cos[t] + 0.5 t), {t, 0, x}], {x, 0, 40}] Mathematica evaluates this integral for each point, which takes a long time. It is ...
6
votes
0answers
95 views

Using a Mathematica index as a DiscreteVariable in NDSolve when solving a coupled set of ordinary differential equations

Context Since the explanation below of the problem to be solved is lengthy, let me preamble this by saying that I have code that works to solve the problem, but I don't know whether (1) it's ...
0
votes
0answers
95 views
0
votes
1answer
85 views

Numerical integral speed

I have the following code to calculate a numerical integral for any given a, however it takes a very long time, even with adaptivemontecarlo, which is not accurate enough: ...
18
votes
4answers
814 views

A bug in Integrate

Integrate[(1 + 16 Tan[2 x - y]^2)/(1 + 4 Tan[2 x - y]^2), {x, 0, 2 π}] Mathematica (wrong) output is (tested under versions 8 and 10.0, took ~ 1 minute of CPU ...
1
vote
0answers
79 views

How to incorporate the boundary conditions into the differentiation scheme in MMA?

Let that we want to numerically solve the following PDE \begin{equation}\label{sde} -r V(S,t)+r S \frac{\partial V(S,t)}{\partial S}+0.5 S^2 \text{sigma}^2 \frac{\partial ^2V(S,t)}{\partial ...
7
votes
2answers
223 views

Why does Mathematica say $\int_0^1\int_0^1\int_0^1\frac{1.0}{xyz}\,dz\,dy\,dx=0$?

Mathematica 9 says that $\int_0^1\int_0^1\int_0^1\frac{1.0}{xyz}\,dz\,dy\,dx=0$ and $\int_0^1\int_0^1\int_0^1\frac{1}{xyz}\,dz\,dy\,dx=0$. ...
0
votes
0answers
91 views

Plotting a numerical integration

I have the following code to calculate a numerical integral for any given a: ...
0
votes
0answers
48 views

Solve an integral equation: to fit the given data with an integral of two functions?

I am trying to find an efficient way to solve the following equation $$h\left(b\right)=\int_{0}^{b}f\left(\frac{b-c}{1-c}\right)\frac{g\left(c\right)}{1-c}dc$$ where for $h(b)$ I have the data ...
2
votes
1answer
120 views

Solving an integral equation numerically

my problem is: I get the result of definite integral and now I need to find the upper limit for the same integral but with opposite sign value so f2=-f1. ...