Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

2
votes
1answer
17 views

code is ignoring WhenEvent

I would like the value of x[t] to be equal to 0 when it has a negative value so I used WhenEvent but it has no effect on my code ...
6
votes
3answers
344 views

Calculating integral by Romberg Algorithm

In my "Numeric Anasyis" course, I learned the Romberg Alogrithm to calculate the numerical integral. The Romberg Alogrithm as shown below: $$ ...
3
votes
2answers
96 views

Help with Integration

I am new to Mathematica, and I need help with integration of the following Reliability expression (from a well-known Reliability Model). $$R(t)=e^{-Ne^{-bt_i}(1-e^{-bt})}, t \geq 0$$ I have ...
9
votes
1answer
722 views

NDSolve::ndcf: Repeated convergence test failure. How to solve?

I am trying to simulate a system of $n$ pendulums with some friction in Mathematica 9. This is the code I am using: ...
-3
votes
0answers
59 views

Numerical integration giving trouble [on hold]

Recently I have been struggling with this problem and I think an outside look (and expertise) is what I need. I have a set of equations that in the end give me the tuple ...
1
vote
0answers
114 views

Numerical solution to integral equation

I have an integral equation where one factor $f(t)$ in the integrand is defined in terms of an integral equation where it is again a factor. $\quad \quad y[t]=\int _0^tf[\tau ]g[t-\tau ]d\tau + ...
3
votes
3answers
165 views

Inefficient NIntegrate and Which

In version 10 a simple numerical integraton of piecewise function is highly inefficient: ...
2
votes
0answers
61 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 ...
0
votes
1answer
137 views

How to solve constraint differential equations using If function

I have to solve a series of differential equations along with a constraint that has to be satisfied at each point of time where $t\in [0, 100]$ The model parameters are ...
0
votes
1answer
83 views

How to make the plot smooth

There are some stranges point which cause the figure isn't smooth. I think that the reason is the method of numericial integration. Here is my code, it's pleasure that one can revise the drawbacks in ...
5
votes
1answer
72 views

Integrate yielding a ConditionalExpression but I don't think the condition is necessary

Suppose I take the PDF of the LogNormal distribution with parameters m and s evaluated at x. I obviously get an expression involving m. I now want to integrate that expression not with respect to x ...
3
votes
2answers
70 views

Error control for NDSolve

I have a problem controlling the numerical error associated with the following non-linear ODE : ...
3
votes
3answers
3k views

Retrieve values of InterpolatingFunction

While analyzing a large system of ODE's, I defined a particular ratio p, which contains some variables that are represented by ...
0
votes
0answers
60 views

Two warning messages in NIntegrate and NDSolve

Everybody I am trying to replicate the Figure.7 of the article arXiv:1103.2683 However my plot is different from it, which is as follows Then we can find the differences between both figures, first ...
0
votes
1answer
81 views

How to resolve the singularity in NDSolve

I ran into a problem in my Mathematica code. There is a singularity or stiff system in NDSolve. The explicit code is as follows: ...
6
votes
2answers
210 views

When analytical and numerical methods do not agree - Case study with Maximum Likelihoods methods

Here is the probability distribution I am interested in: $$P(q)=C e^{4 n s q} q^{4 n \nu - 1} (1 - q)^{4 n \mu - 1}$$ , where $e$ is the constant of Euler and $C$ is constant so that the whole thing ...
2
votes
3answers
350 views

How can I apply calculus to functions obtained from NDSolve?

Originally, I asked the question below, but the real underlying issue is as follows: When we solve an ODE numerically, I get the answer like this: ...
3
votes
2answers
146 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 ...
0
votes
0answers
79 views
0
votes
0answers
54 views

Expectation value with Mathematica code

I need to evaluate the evolution in time $t$ of expectation value of the operator $\rho$ on the state represented by the wave packet $\Psi(\beta_{+},\beta_{-},\rho,t) = \int\int_{reg} dk_{+}dk_{-} ...
7
votes
2answers
274 views
4
votes
1answer
84 views

memory leaks using NIntegrate on parallel kernel

Bug fixed in version 10.2.0 I'm running a large computation in parallel and the memory usage of the parallel kernels is increasing with every iteration of the calculation. Neither ...
4
votes
2answers
157 views
2
votes
0answers
69 views

How can I get constant of integration? [closed]

When using Integrate, Mathematica sets a constant of integration automatically. But sometimes we are given that constant already and it should be used in order to ...
14
votes
6answers
1k views

How do I obtain the enclosed area of this particular parametric plot?

I'm trying to find a way to obtain the enclosed area of this particular plot. Can someone show me how? ...
0
votes
1answer
54 views

Boundary discretize region of ellipsoid returns a three dimensional region

I need to integrate a rather complicated function on an ellipsoidal surface, specifically a prolate spheroid surface. Im using the mathematica 10 feature of discretize the regions in mesh and pass ...
1
vote
0answers
44 views

Numerical Derivative after numerical integration [closed]

I am trying to find the numerical derivative of a function whose argument defines the bounds of a numerical integral. ...
0
votes
1answer
104 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 ...
9
votes
2answers
393 views

Why do I get a different value when I change the order of integration?

I think the following two-dimensional integrals should be equal, since they both integrate the function over the half plane defined by $t>\tau$. $$\int_{-\infty}^\infty \mathrm{d}t ...
4
votes
1answer
99 views
1
vote
1answer
80 views

Performing piecewise integration

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

Problem with NDSolve and Sign

If c1 cnd c2 are zero, the code responds very well; but if one of c1 or ...
2
votes
1answer
44 views

How should I evaluate the numerical integral of a function with divergent part substracted?

I want to evaluate the following integral numerically in Mathematica, $$\int_0^{\infty}(\frac{1}{(1 - e^t)^{10}} - (\frac{1}{t^{10}} - \frac{5}{t^9} + \frac{145}{12 t^8} - \frac{75}{ 4 t^7} + ...
0
votes
0answers
39 views

Trouble evaluating singular and oscillatory integral

I have a lot of trouble to calculate the following integral with singularities $$ I= \frac{1}{(2\pi)^2}\iint_{-\infty}^{\infty} k_t^2 \frac{ k_{1,z} - ik_{0,z} \varepsilon_1 \cot\left(k_{1,z} ...
2
votes
1answer
181 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
140 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 ...
25
votes
2answers
2k views

Complex valued 2+1D PDE Schrödinger equation, numerical method for `NDSolve`?

Based on the heat equation of the Mathematica Manual tutorial, I wrote the complex counterpart (Schrödinger) equation, for the free particle propagation of an initial wavepacket. ...
0
votes
1answer
102 views

Existence of an analytical form for integral

Can the following integration be performed with an analytical output? ...
4
votes
2answers
134 views

FEM giving “ … is not a polynomial error”

Executing the program below I get the ... is not a polynomial error message. I don't have an idea why I am getting this -- any suggestions? ...
6
votes
0answers
131 views

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 ...
2
votes
1answer
546 views

Creating hexahedral finite elements in Mathematica

Is it possible to do FEM using hexahedral elements in Mathematica? If it possible, is there any help to do that?
2
votes
1answer
74 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: ...
10
votes
6answers
732 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 ...
2
votes
1answer
81 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} = ...
0
votes
0answers
43 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. ...
3
votes
2answers
337 views

How to numerically integrate this integral

I am unable to do this definite integral in Mathematica 9. Is there any command so that I can get the numerical value of the above integration? Code: ...
6
votes
2answers
165 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
2answers
135 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 ...