Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

5
votes
0answers
53 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
50 views

Solving Improper Integral [on hold]

I am facing the singularity problem while solving the integral. The integral is improper in the point x1 ...
1
vote
2answers
61 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 ...
3
votes
1answer
222 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 ...
2
votes
1answer
497 views

Use Euler method to solve differential equation

Use Euler's Method or the Modified Euler's to solve the differential equation ${dy/dt=y^2+t^2-1, y(-2)=-2}$ on $[- 2, 2]$. Take h = 0.2 (...
2
votes
2answers
435 views

Plotting several numerical solutions plus the analytic solution of ODE in one plot

I want to be able to plot several numerical solutions of an ODE, plus its analytical solution in one plot, in order to see how the numerical solutions converge towards the analytical one with respect ...
1
vote
1answer
860 views

Euler's method for system of differential equation

I need to program Euler's method to solve a system of two diffferential equations of first order. Fist, I have programmed the Euler's method for just one differential equation: ...
5
votes
1answer
628 views

NestList and Euler's method

I am new to mathematica and so just experimenting with various programming constructs. Recently have been looking at NestList and how I could use this to implement ...
3
votes
1answer
95 views

Precision of NIntegrate

At the moment I am considering a "difficult", highly-oscillatory integral in Mathematica. It calculates the integral without any complaints. However, I am also trying out a numerical method with which ...
1
vote
2answers
76 views

Plot3D and NIntegrate issues

f[x_, y_] := 2*x - y Plot3D[f[x, y], {x, -1*Sqrt[4 - y^2], Sqrt[4 - y^2]}, {y, -2, 2}] NIntegrate[f[x, y], {x, -1*Sqrt[4 - y^2], Sqrt[4 - y^2]}, {y, -2, 2}] I ...
2
votes
1answer
159 views

Evaluation of the second argument to NIntegrate

The expression Integrate[x^2, Flatten[{{x},{1,2}}]] evaluates properly, to $\frac{7}{3}$. However, ...
1
vote
1answer
122 views

Integrate and NIntegrate yield different results for double integral

Evaluating a double integral with bivariate normal distribution yileds widely different results depending on the method used. I define a bivariate normal distribution with ${10, 3}$ and ${8, 1.5}$ as ...
1
vote
2answers
226 views

How to numerically integrate this integral?

I want to integrate a function (spherical coordinates): $$\int _0^{2 \pi }\int _0^{\pi }\frac{r^2 \sin (\theta ) e^{-\lambda \sqrt{\rho ^2+r^2-2 \rho r \cos (\theta )}-2 r}}{\pi \epsilon ...
16
votes
5answers
390 views

Mismatch between numerical and analytic evaluation of an integral

I evaluated the following integral $$\int_0^1 \sqrt{r} \left | \cos \left(\left(k+\frac{1}{2}\right) \pi r\right)\right | dr$$ ...
2
votes
2answers
116 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 ...
2
votes
2answers
222 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 ...
18
votes
4answers
734 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
1answer
77 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: ...
19
votes
2answers
1k views

Why does Mathematica give the wrong answer when integrating?

I integrate Integrate[Exp[I Cos[b - c]] Cos[b], {b, 0, 2 Pi}] Mathematica gives: 2 I Pi BesselJ[1, 1] Which is indepedent ...
0
votes
0answers
87 views

Plotting a numerical integration

I have the following code to calculate a numerical integral for any given a: ...
1
vote
0answers
57 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
209 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
38 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
106 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. ...
-3
votes
0answers
43 views

Problem with Integration [closed]

I have a problem with numerical integration of this function. Is there any way for this calculation? ...
0
votes
0answers
44 views

Solving a delay partial differential equation

I am trying to solve the following partial differential equation, $$\frac{\partial\phi[t,x]}{\partial t}=-2\pi\ \delta \ e^{-t}\phi[t,\mu]^{-2} \frac{\partial}{\partial x} \phi[t,x](x-\mu)$$ where ...
5
votes
1answer
216 views

What's wrong with NIntegrate with “MonteCarlo” Method?

My code is: NIntegrate[1, x \[Element] ImplicitRegion[(x > 5 && x < 9) || (x > 11 && x < 13), {x}], Method -> "MonteCarlo"] ...
2
votes
1answer
119 views

NIntegrate Warning / Error Messages

I am doing: NIntegrate[Sin[Exp[(x^4)]], {x, 2, Infinity}, PrecisionGoal -> 12] It prints out a host of warnings, but also shows the results as: ...
0
votes
0answers
71 views

NIntegrate gives message NIntegrate::vars:

As seen in the code below, I initially constructed a list of functions of two variables ζ and t0. These functions are pure ...
0
votes
1answer
58 views

NDSolve issue with initial and boundary conditions

While solving the heat equation in one spatial variable $u_t = u_{xx} $ (x goes from 0 to L) with the initial temperature distribution $T_0 \frac{x(L-x)}{L^2}$ , and with neumann boundary conditions ...
0
votes
0answers
57 views

Using Fourier to return exponential function

I am trying to use Fourier to numerically demonstrate the following identity: $$ \frac{1}{2\pi}\int_{-\infty}^{\infty}\frac{e^{i\,s\,y}}{1 + a\,s}ds=e^{-y/a} $$ I'm getting the correct shapes, but my ...
2
votes
1answer
94 views

Approximation of definite integral by parabolas

This question is related to Trapezoid approximation to definite integral. As promised, I am now asking about how to draw approximation of integrals by parabolas. I tried to modify MarcoB's code, and I ...
1
vote
2answers
110 views

Integral too oscillatory

Is there any way top make this integral less oscillatory? ...
0
votes
0answers
44 views
5
votes
1answer
125 views

Why does Nintegrate keep unevaluated?

It's no surprise that the "MonteCarlo" Method works well: ...
2
votes
0answers
35 views

The idea behind Stiffness switching method with NDsolve [closed]

Does the Stiffness switching method with NDsolve switch just between multiple variants of 4th order Runge Kutta method or it uses also other methods?
0
votes
0answers
41 views

NIntegrate evaluating to “non-numerical values” for some input values despite using ?NumericQ

I'm quite new to Mathematica and I'm finding myself wanting to compute an integral for which my code produces errors of the kind: "NIntegrate::inumr: "The integrand ... has evaluated to ...
2
votes
1answer
130 views

How can I invoke the solution of NDSolve to determine a parameter in my equation just inside NDSlove?

I am trying to solve a differential equation by NDSlove for $h(x,t)$. It reads $$h_t=h_{xx}-V_h-\lambda(t)$$ where $V_h$ is a given function of $h(x,t)$ denoted by ...
0
votes
1answer
100 views

How to do multiple integral numerically?

I cannot calculate the following type of integrals numerically : $\int_0^1 dy \int_0^y f(x) dx $ $f(x)$ can be a complicated function. The problem is due to the fact that the upper limit of one of ...
2
votes
1answer
56 views

How to NDSolve a set of equations, one of which itself contains NIntegrate of a desired function?

How to NDSolve a set of equations, one of which itself contains NIntegrate of a desired function waited to be solved by NDSolve first? For example, ...
2
votes
1answer
50 views

Why isn't Table iterator value inserted in failed NIntegrate arguments?

Consider this simplest example: Table[{z, NIntegrate[f[x], {x, 0, z}]}, {z, {1}}] Here f is not defined, so ...
6
votes
2answers
471 views

Starting NDSolve from intermediate time step?

I always wondered if I could start NDSolve from an intermediate time step. What I mean is, in the code sample below, if I were to run my solution from ...
0
votes
1answer
19 views

NIntegrate fails when integrating over a list from an external (MathLink) function

NIntegrate fails when integrating over a list from an external (MathLink) function. For simplicity, consider an external function f[x] that returns the list {x,2x}. In Mathematica, the function would ...
0
votes
2answers
83 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: ...