Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

0
votes
0answers
26 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] ...
1
vote
3answers
109 views

NIntegrate Trapezoid rule with even subdivision producing poor results

NIntegrate[x^2, {x, 5, 9}, Method -> {"TrapezoidalRule", "Points" -> 2, "RombergQuadrature" -> False}, MaxRecursion -> 1] returns the ...
0
votes
1answer
63 views

Compute integral symbolically

I want to compute the following integral: ...
0
votes
0answers
42 views

Pass model parameters to NDSolve'Reinitialize

I am wondering if there is a way to pass parameter values during the NDSolve'Reinitialize step of the NDSolve process? I've read that one way to possibly speed up repeated calls to NDSolve is to ...
0
votes
1answer
153 views

Numerical solution of the hyperbolic equation

I am trying to solve the following hyperbolic equation with given boundary conditions: I choose as initial condition $u=1$, and evolve the above hyperbolic equation until reaching a stationary ...
0
votes
0answers
55 views

Resolving initial / boundary condition conflicts ?

This is likely very simple, but I often run into trouble with inconsistent boundary conditions for PDEs; While I know Mathematica sometimes produces "false" errors for spatial derivative conditions, ...
0
votes
2answers
209 views

Problems with NIntegrate

I'm having trouble to do the following numerical integrations: ...
0
votes
3answers
141 views

How to display the value of a very small number instead of “0.” [duplicate]

I need to perform an integration. There is one particular value, which may be very small that is showing up as 0.. Is there any command in Mathematica 9 that will ...
0
votes
0answers
97 views

To solve an equation

I am trying to solve the equation: Solve[Re[Integrate[(2 c - (r^2) Exp[- I 1.4746])^(0.5), {r, 0, 31.7576}]] == 2.1216, c] I want to integrate an expression in ...
1
vote
0answers
39 views

Nested NIntegrate of vector function

I am performing a nested integration where the upper limit of the inner integral depends on the value of the outer integral, like in the question [Nested NIntegrate]. As in this question my function ...
1
vote
2answers
92 views

Problem evaluating a complicated integral

Apologies for stating my problem poorly in the first instance, thank you for the help in narrowing down the issue. Problem For those interested, it's for the exact unbiased inverse of the ...
2
votes
0answers
91 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 ...
1
vote
0answers
86 views

Speeding up the numerical integration of a certain function

I'm using the following function f[t_] := 3/4 t^-3 NIntegrate[(x^4*Csch[x/2]^2), {x, 0, t}, Method -> {Automatic, "SymbolicProcessing" -> 0}]; I ...
0
votes
1answer
66 views

How to get correct numerical integration which should be zero? [duplicate]

I want to numerically integrate function berrycur over kx and ky. The definition of berrycur is given at the end of the ...
0
votes
1answer
341 views

wolfram mathematica intersection of two surfaces [duplicate]

I use wolfram mathematica. There is a function of two variables which defines the surface z = f(x,y), the second surface is defined as z = const. How to find the line of intersection of these two ...
0
votes
0answers
36 views

NIntegrate Issue: Changing integration limits makes calculation time extremely long

After a long time developing some code in mathematica and finally getting it to work, I have unfortunately encountered an odd problem: When I change the limits of integration (and shift the function ...
-1
votes
2answers
78 views

Strange numerical integration result

I write a function called berrycur[kx,ky] which I will give at the end of the question, and want to numerically integrate this function over {kx, -2π, 2π]}, {ky, 0, ...
0
votes
0answers
39 views

Comparing NIntegrate with definite integration

I want to calculate without error a sum of double integrals with the following definitions for the functions within them: ...
0
votes
1answer
66 views

Numerical integration with purely numerical integrand

I'm trying to perform a numerical integral with an integrand that should not be manipulated with any symbolic preprocessing whatsoever. Consider the following simple test : ...
0
votes
0answers
213 views

NIntegrate: integrand has evaluated to non numerical values

I have pasted a code that has been giving me some trouble and errors when I try to compute. ERROR: "The integrand 1435.1232 E^(-6.4703566*10^6 s^2) deEntrance[s,phi]^2 has evaluated to ...
1
vote
0answers
114 views

NIntegrate (multi-dimensional integral)

I am interested in the numerical evaluation of the following integral: $\int \prod_{i=1}^n dx_i \delta(\sum_{i=1}^n x_i) \prod_{i=1}^n f_i(x_i)$ where $f(x)$ is a complicated function. Unfortunately ...
3
votes
2answers
210 views

Integration and Fourier transform

I would like to calculate the distribution function from the characteristic function. There is a formula given as $$F_X(x)=\frac{1}{2}+\frac{1}{2\pi}\int_{0}^\infty \frac{e^{i w x}\phi(-w)-e^{-i w ...
5
votes
2answers
283 views

Calculating the area under a curve, but above a certain threshold value

so here I am with a time series of data (hours (t) and corresponding measurements (a)). ...
0
votes
1answer
113 views

NIntegrate: Catastrophic loss of precision

Below is a simplified code that I am trying to evaluate. I am basically getting the rms value of a Wakefield function. When I finally try to evaluate the rms, I get an error. Any help would be greatly ...
3
votes
2answers
111 views

NIntegrate returns zero for non zero integrand, 4d Integration

I am trying to calculate the following integral. ...
0
votes
1answer
64 views

Integrating function can't be epressed? [closed]

Hi I have a function in a form of $$\frac{a}{x}exp(\frac{b}{\sqrt{3}-x})$$ The code is Integrate[a/x*E^(b/(3^0.5 - x)), {x, 1, 3^0.5}] But it can't work ...
6
votes
3answers
368 views

RK4 Gravity Simulator

I have the following RK4 solver which splits the two 2nd order ODEs, used to calculate x and y positions under the influence of a gravitating body where $$x''(t)=\frac{G m ...
0
votes
0answers
76 views

Code for solving numerically an integro-differential equation

First of all, I want to greet the community. This is my first question, but I hope I will be able to help answering others members questions, although I am quite new working with Mathematica. I would ...
0
votes
1answer
37 views

Calculate Integral with cos [closed]

Integrate[ (Pi/4 - x/2) cos (n *x), {x, 0, Pi}] This doesnt give me desired results .n is natural 1,2,3,4,5... I want to get something like ...
1
vote
1answer
110 views

NIntegrate failed to converge?

Hey guys I have a pretty simple code that consists of an RMS calculation. The issue is that I am getting quite a few error messages when I run it. The following equations are highly published physics ...
1
vote
0answers
67 views

Speeding Up NIntegrate and ?NumericQ

I have attached below a piece of code that has been running successfully but takes extremely long for mathematica to compute. I believe it is the last "rms" calculation and the fact that I am using ...
0
votes
1answer
44 views

Error message from NDSolve using WhenEvent

I am working with the following NDSolve expression: ...
2
votes
4answers
379 views

How to calculate this integral?

I am trying to Integrate the following Integral : $\int_1^{\infty } \dfrac{\left(x^2-1\right)^{13/2} e^{-ax} }{x^{10}} \, dx \,\, \,\,\,\,\,\,\,\,\,\,\,\,(a=\textrm{real>0})$ Mathematica didn't ...
2
votes
2answers
315 views

How to compute this triple integral? [closed]

In Mathematica how can I compute this integral:$$ \iiint_{D}\sqrt{(1-9z^2)(1-4y^2-9z^2)}\,dx\,dy\,dz$$ where D is the domain: $$D: x^2 +4y^2+9z^2\le1$$ Please I need help!!!
1
vote
1answer
220 views

Runge-Kutta 2nd Order ODE Solver

Suppose I have a 2nd order ODE of the form y''(t) = 1/y with y(0) = 0 and y'(0) = 10, and ...
1
vote
0answers
55 views

Multidimensional Numerical Integral with Singular Behavior [closed]

I'm trying to numerically integrate a multidimensional integral where there is singular behavior when x = y. This is the integral ...
3
votes
1answer
175 views

Integrating a functional of an InterpolatingFunction

It is straightforward to Integrate an InterpolatingFunction. However, even for a simple functional of an ...
7
votes
1answer
77 views

Unify the sampling of NIntegrate[ {f, g, h} w ]

I'm trying to numerically integrate a function which has a vector-valued slow part and a much faster component which is shared by all the components, i.e. an integral of the form $$ ...
0
votes
1answer
113 views

Better way to check conservation in NDSolve

The partial differential equation in the NDSolve below is conservative (by construction) of $\int_{-1}^{+1} p(t,z)\ dz$ for all $t$. ...
0
votes
1answer
148 views

Zooming into Parametric Animation Plot that Uses InterpolatingFunctions

I have an interplanetary trajectory solver that calculates a spacecraft route from Earth to Mars, and I am trying to zoom into the spacecraft when it reaches its Mars intercept orbit but am having ...
0
votes
1answer
131 views

Help using NIntegrate

I need some help with NIntegrate. I pasted the code that I wrote below; I know that up to "de" is correct. What I would like to do is NIntegrate de w.r.t phi{0,0.1} and curlE{-10,10}. The final ...
0
votes
0answers
50 views

Ideas for NDSolve?

I'm currently trying to find a numerical solution to a differential equation of the form: D[W[X], {X, 4}] ==(-(1/(delta + G - (G X)/L)^2) + 1/(delta + (G X)/L)^2) ...
3
votes
0answers
52 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 ...
0
votes
0answers
88 views

Problem with using the results of ParametricNDSolve in a ParametricPlot3D

I new to Mathematica and I have a problem with certain equations. I want to plot a trajectory in spherical coordinates given by the equations: ...
0
votes
0answers
113 views

A power series expansion

Consider the function, $f(z) = z tanh(\pi z) log (z^2 + a^2)$ for some $a>0$. Now I am considering 3 different situations, $z = i(n+0.5) - i\epsilon + \delta - it$ for $n \in \mathbb{Z}$ and ...
0
votes
0answers
68 views

Solving an ODE, where the coefficients are implicit functions of time, not in closed form [duplicate]

I have an ODE, say of the first order for simplicity, and of the form, $A.x'[t] =B$. The coefficients are functions of time and x[t], not in closed form. I can define the coefficients, $A$ and $B$, ...
0
votes
1answer
118 views

Numerical integration of two variable function

The aim is to calculate the definite integral of the function $f$ of the form $$f(x,t) \;\;\;\; x \in [0, \infty ) \;\;, \;\;t \in [t_0,T]$$ numerically. For example consider the function below $$f = ...
1
vote
0answers
43 views

Optimising code for nested integrals

See below for some code I wrote to model a non-homogenous poisson process. The code generates the correct results but takes a long time due to the number of nested integrations. I have tried reducing ...
0
votes
1answer
90 views

Integrand evaluating to non-numerical values

I have solved a system of equations using NDSolve just fine. From there, I can plot the solutions $u(x)$ and $v(x)$, as well as its derivatives, just fine. But, when I want to evaluate the energy ...