Questions on the use of numerical functions NIntegrate and NDSolve.

learn more… | top users | synonyms

4
votes
2answers
366 views

Volume of a graph

I have the following list: ...
4
votes
5answers
259 views

NIntegrate::slwcon Problem

I have a problem with numerical integration of this function. Integral value is zero, but NIntegrate[] needs a lot of time to calculate this. Is there any way to ...
4
votes
4answers
814 views

Numerical differentiation methods

Is it possible to write a code in Mathematica that implements various differentiation methods (like forward, central, extrapolated, etc.)?
4
votes
1answer
467 views

Is it possible to calculate a Lebesgue integral in Mathematica?

As the title says, I wonder if it is possible to calculate a Lebesgue integral in Mathematica, especially when the domain of integration is $\mathbb{R}^N$, or in other words multivatiate Lebesgue ...
4
votes
2answers
162 views

LevinRule and SphericalBessels

I'm currently looking at a simplified problem that approximates another problem I'm looking into. In this simplified problem I at least have an analytic integrand and can easily provide all info on ...
4
votes
3answers
279 views

How could I get the value of y[t] at each specific interpolation point?

sol = NDSolve[{Derivative[2][y][t] + Sin[y[t]] == 0, Derivative[1][y][0] == 0, y[0] == 1}, y, {t, 0, 2}] the above-mentioned differential equations can be solved ...
4
votes
2answers
1k views

Is it possible to compute trapezoidal rule numerical integration?

Is it possible to compute trapezoidal rule numerical integration? I know that Mathematica has Interpolation, and that a list of points can be interpolated and then ...
4
votes
1answer
231 views

Integral of integral — it takes too much time

When I evaluate the following expression in Mathematica, it takes so much time that I don't want to wait for the evaluation to complete. So I think that there must be a better approach. ...
4
votes
2answers
194 views

How to use NIntegrate when there are symbolic constant coefficients

I would like to numerically integrate an equation such as the one below in which there are symbolic constant coefficients. I used a very simple code but it doesn't work in general, that tried to deal ...
4
votes
3answers
502 views

Numerical solution of a differential equation with NIntegrate coefficients

I am trying to solve a linear ODE with a variable coefficient which is given in terms of an integral I can only do numerically. That is, I have an equation of the form $$ ...
4
votes
1answer
332 views

Differential Equations with Matrices

I'm trying to implement the differential equation of a Cellular Neural Network in Mathematica as seen below: ...
4
votes
1answer
837 views

Incorrect solution of diffusion equation with Neumann boundary conditions

I want to set up a PDE model, which takes a two-dimensional diffusion equation into account. The key problem is that I have some trouble in solving the two-dimensional diffusion equation numerically. ...
4
votes
1answer
92 views

How to use WhenEvent with a vector ODE in NDSolve

I have an ODE system I'd like to specify as a vector equation in NDSolve. I'm not clear on how to use WhenEvent for a system ...
4
votes
2answers
422 views

WhenEvent in NDSolve

How come this doesn't work as I intended? ...
4
votes
1answer
178 views

How to find derivative of a numerical solution, where precision is ambiguous?

I am trying to take the derivative of a numerical solution. I am concerned that the way I'm doing this may be problematic due to numerical error; I think there must be a better way but I'm not very ...
4
votes
2answers
152 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)). ...
4
votes
1answer
157 views

Find lengths of contours in a ContourPlot

I am trying to find the lengths of different contours in the following plot: It is a complicated piecewise function evaluated on the unit disk. I am hoping there is an easy, generalized way to ...
4
votes
1answer
172 views

How to demonstrate lack of stability with advection equation

I am trying to that using a coarse grid with an explicit method for, say, the advection equation leads to an unstable solution. The trouble is Mathematica avoids unstable solutions with good ...
4
votes
1answer
295 views

Error Interpretation in NIntegrate

I am using a recursion algorithm developed by Migdal for Lattice Field Theory, and I have the following code: ...
4
votes
2answers
705 views

How to Solve this ODE with Mixed Boundary condition

I have an ODE equation which is sort of y''[x] + 2 y'[x]/x + .0001 (y[x])^3 ==0 subject to the boundary conditions ...
4
votes
2answers
397 views

Numerical Integration as Model for Nonlinear Fit

I'm trying to do a fit for parameters of a function within an integral but I'm getting errors when I try and run it. Essentially I want the following fit to work out: ...
4
votes
1answer
416 views
4
votes
2answers
2k views

How to handle NDSolve::ndsz problem (singularity problem)

I have 2 second order differential equations (non-linear). The physics behind them is correct. I verified the equations many times. It is a solid pendulum with a mass-spring at the end of it. Now, ...
4
votes
2answers
1k views

PDE Boundary Conditions

I am solving a PDE using Mathematica and I would like to know how to implement the condition that the two-variable function y[t,s] is zero whenever ...
4
votes
1answer
192 views

How to choose MaxStepFraction for optimal speed of NDSolve

I'm trying to use NDSolve to solve a 1D Schrodinger's equation, and it seems that MaxStepFraction has huge effect on the ...
4
votes
1answer
352 views

Multiple simultaneous events in EventLocator method for NDSolve

I'm using NDSolve to integrate a system of ODEs, and EventLocator to stop the integration when it leaves a certain region in phase space. This works perfectly as it should. However, I've also added ...
4
votes
0answers
267 views

NDSolve: ProcessEquations and Reinitialize with Piecewise functions

I am having trouble with using NDSolve`Reinitialize when the system consists of a pieceise function. If we define the ODE system ...
4
votes
0answers
116 views

Numerical solution of Schrödinger-type equation in Mathematica [duplicate]

I want to solve the following differential equation numerically: \begin{equation} i\partial_{t}\psi(r,t)=\left[-\frac{\Delta}{2m}+g\left|\psi(r,t)\right|^{2}+V_{d}(r,t)\right]\psi(r,t) \end{equation} ...
4
votes
0answers
273 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 ...
3
votes
2answers
167 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 ...
3
votes
2answers
2k views

Solving a system of ODEs with the Runge-Kutta method

I´m trying to solve a system of ODEs using a fourth-order Runge-Kutta method. I have to recreate certain results to obtain my degree. But I'm a beginner at Mathematica programming and with the ...
3
votes
1answer
693 views

How to plot and solve the numerical solution of a integro-differential equation

I have a integro-differential equation of the form $y'(t) = - \int_0^t {y(t_1 )} e^{t_1 - t} dt_1, {\rm{ t}} \in {\rm{[0,10], y(0) = 1}}$ My code is: ...
3
votes
2answers
275 views

Speed of convergence for NIntegrate

I'm trying to optimise numerically a function that entails computing the expected value of a truncated trivariate normal distribution and this is taking extremely long -I also get warned about ...
3
votes
1answer
162 views

Convergence in NIntegrate vs Integrate

I am faced with this situation that for a certain integration, $\int _0 ^\infty \frac { \tanh (\pi \sqrt{x} )} {\sqrt{x+10} } dx$ - the command Integrate returns ...
3
votes
1answer
295 views

Why this numerical integration takes so long?

Let me explain the problem. I am trying to integrate a one dimensional integral: $$\int {g\left( {{k_x}},parameter1,parameter2,...\right)d{\mkern 1mu} {k_x}} $$ for the sake of clarity, I will give ...
3
votes
1answer
369 views

Solving the Sine Gordon PDE in mathematica

how can i solve this equation in mathematica? this is sine-gordon eq. but the boundary condition can not recognized by mathematica . thank you for you attention. ...
3
votes
1answer
244 views

Evaluating function only when its optional argument is numeric

I want to have the argument 'a' for myf2 in form of optional argument, but at the same time I need to evaluate the function only if 'a' is Numeric, see also my previous question. ...
3
votes
1answer
250 views

Could the PrecisionGoal for NDSolve be a negative number?

The help of Mathematica doesn't say so much about the PrecisionGoal for NDSolve, and I never considered much about it even after ...
3
votes
1answer
555 views

NDSolve Problem

I am trying to solve a chemical equilibrium ODE with NDSolve where one function is the argument to another. I.E. My equations look like: ...
3
votes
2answers
610 views

Compute integral symbolically or numerically

I want to compute the integral of the following integrand ...
3
votes
1answer
179 views

Differentiating ParametricNDSolve solutions

Is there any way to differentiate a solution obtained by ParametricNDSolve? For instance, I have the position $\phi_\gamma(t)$ as a function of time, parametrized ...
3
votes
1answer
372 views

Solving an ODE numerically

I really appreciate it if anyone helps me with this: How can I solve this ODE and plot the answer for $x$ on $[0.6,5]$: $$ \begin{align*} -2xy'[x] = y''[x]+ 47.21 (-.0025 x^6 & + ...
3
votes
1answer
267 views

A Bessel & Struve functions related integral

I try to numerically compute this integral and I don't figure out why on earth Mathematica is not able to do it. Is my input correct? Does it possibly have a closed form? ...
3
votes
1answer
303 views

Tips for efficiently solving large system coupled (nonlinear) ODEs

I'm trying to solve a system of nonlinear, coupled ODEs, where the governing equation for the $n-th$ ODE is of the form: $\sum_k^M Q_{nk} \ddot{a}_k -\sum_{\ell}^M\sum_k^M S_n(\ell,k) \dot{a}_{\ell} ...
3
votes
1answer
431 views

Singular integral: NIntegrate fails to converge

I need to calculate the following singular integral: NIntegrate[Log[1 + y^2]/Cos[Pi y], {y, 0, 1}] However, it is failing to converge. I have tried to specify ...
3
votes
2answers
358 views

Animating the Lorenz Equations

I am trying to use the Animate command to vary a parameter of the Lorenz Equations in 3-D phase space and I'm not having much luck. The equations are: ...
3
votes
1answer
316 views

Integrating over data points from an external source (wolfram|alpha and weather)

I moved to another city and the weather sucks. Sometimes I feel like getting sad and so I go to wolfram|alpha and check for example ${}$ ...
3
votes
1answer
168 views

Integrate equations of motion when force depends on position

I'm fairly new to Mathematica. I'm trying to test my C++ implementation of a fourth order Runge Kutta method for Newton's equations of motion. I want to test my integrator when the applied force is ...
3
votes
1answer
454 views

NDSolve for a large system of simple ODEs

I am solving a system of many (more than 100) ODEs. It is the kind of standard rate equation encountered in semiconductor physics. Here is the system: ...
3
votes
2answers
513 views

NDSolve: Normalizing at every step

Suppose I have an transport equation with an initial conditions: ...