Questions tagged [numerics]

Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

NDEigensystem and radial function equation for Hydrogen atom

I'm trying to numerically solve the radial equation for the 3D hydrogen atom problem, i.e., to find $R(r)$ which satisfies: $$ -\frac{\hbar^2}{2m}\left[\frac{1}{r}\frac{d}{dr}\left(r^2\frac{dR(r)}{dr}\...
1
vote
2answers
36 views

Find all minima of a list of points

Given a list of points {x[i],y[i]} I would like to find all the local minima of y Example: ...
0
votes
1answer
64 views

Plotting a small Gaussian | Small values and dealing with machine precision

I've defined the following: k := 1.38*10^-16 kev := 6.242*10^8 q := 4.8*10^-10 g := 1.66*10^-24 h := 6.63*10^-27 and ...
2
votes
2answers
52 views

Using a list inside NDSolve

I have a coupled differential eqations: ...
0
votes
1answer
32 views

ParametricNDSolve not returning an interpolating function after specifying parameter vlaue

I am solving a set of 4 different ODEs with ParametricNDSolve. When I specify the a value for the parameter instead of getting out an interpolating function, I keep getting back a parameter function. ...
0
votes
1answer
107 views

Zeros or minima of a multivariable function [closed]

what is the most reliable method for finding the zeros or at least the minimum of $f(x,y,z,w,r)= - \frac{3}{96 \pi^{2}z^{4}} \int_{y}^{\infty}\sqrt{x^{2}-y^{2}}x^{2} e^{-x} dx+ \frac{3}{16 \pi^{2}(1-r^...
0
votes
1answer
32 views

Problem evaluating numerical value of MeijerG[] function at some parameter?

I need to evaluate this sum: Where x = 33.6614 and $k,l,s$ are non-negative index of the three sum. For example $k,l,s=0,1,2,3,...$. Furthermore, $M$ is a positive integer that is $M=1,2,3,4...$ ...
16
votes
2answers
358 views

3D Inclusion with structured mesh and coarse and arbitrary matrix

I am wondering if there is a simple way to define a structured 3D mesh (inclusion) like e.g. that and surround it with a corse and unstructured Matrix. It should be possible to refine both more or ...
2
votes
0answers
50 views

Problem with stopping NDSolve after a condition is met

I'm trying to write a piece of Mathematica code that is essentially a differential equation solver that needs to take a specified function $V[t,q]$, and then numerically solves the differential ...
3
votes
2answers
81 views

Specific problem with NDSolve step size, stiffness

I am trying to solve a non-linear second order boundary value problem in a finite interval. The differential equation is $$y''-\frac{a}{b}y-\frac{u_n}{b}y^3-\frac{ge_0}{b}x=0,$$ with $x\in[0,L]$, ...
1
vote
0answers
28 views

Discretization of the following integral: an optimal way

Consider an integral $$ I[f_{n},T]=\int \limits_{0}^{\infty} dE_{n}F(f_{n}(E_{n}),E_{n},T)+\int\limits_{0}^{\infty} dE_{n}\int_{\mathcal{F}(E_{n})}dE_{n}^{'}G(f_{n}(E_{n}),f_{n}(E_{n}^{'}),E_{n},E_{n}^...
0
votes
1answer
39 views

WhenEvent doesn't work as expected when the condition is satisfied in the first step

I have noticed strange behavior of WhenEvent in the case where the body of WhenEvent is satisfied in the first step. For example, ...
5
votes
2answers
120 views

Wish to compute ln(x) with millions of digits of precision fast as possible

Computing $\ln(10)$ to 6 million digits of precision on my 2.5 GHz machine running Mathematica 12.1 takes about 23 seconds using the methods below. Wish to compute $\ln(x)$ with much higher precision....
1
vote
0answers
107 views

Solving the following system of integrodifferential equations: speed up of the code

Consider a system of equations $$ \begin{cases}\frac{\partial f(E,t)}{\partial t}-H[T_{\gamma},f(E,t)]E\frac{\partial f(E,t)}{\partial E} -I[f(E,t),E,T_{\gamma}(t)]=0, \\ \frac{\partial T_{\gamma}}{\...
7
votes
2answers
238 views

How to select the fastest approach for large numerical data computations?

I really love the flexibility of Mathematica: there are several ways to perform one task. However, to get the performance of the intense numeric calculation, it can ...
3
votes
1answer
46 views

How to force the function to take positive value when solving PDE by NDSolve

I try to solve this PDE ...
0
votes
2answers
82 views

Why Mathematica gives a wrong result for number form of a simple expression? [closed]

I ask Mathematica number form of $$\sin \left(\frac{4 \pi ^2}{3}\right)+\sin \left(\frac{2}{3} \pi \left(2 \pi -\frac{3}{2}\right)\right)$$ ...
1
vote
1answer
34 views

Improving The Computation time of a recursive numerical method

I am trying to do a recursive numerical method to solve an ODE in Mathematica. Whatever I try, I cannot get the computation time down. I need to do over 1000 steps, but I cannot get even 20 steps ...
-1
votes
1answer
64 views

Determining intersection point in mathematica plot

I plotted the function given in the figure with respect to "z" .I obtained different plots for different distinct values of "t". Now please can you help how to obtain the ...
0
votes
0answers
38 views

Numerical differentiation with respect to a ln of (x)

i want to compute the numerical derivative of a function that depends of x , but the derivative is with respect to a ln of x. Suppose that ns is a function that depends of k, ¿how is the formula or ...
2
votes
0answers
55 views

Code to find the Covariant Lyapunov Vectors

I've been able to find a decent amount of existing resources for computing the Lyapunov Exponents for a system of differential equations. Is there any existing code/resources for computing the ...
2
votes
1answer
200 views

Improvement of code precision using NDSolve for Differential-Algebraic equation

I'm trying to solve a system of 24 non-linear Differential-Algebraic equations (DAE). I'm using the command NDSolve in Mathematica to solve this system, using this command, the error is too much large....
2
votes
0answers
138 views

Solving a Modified Biharmonic Equation on a Square

I am seeking to solve the differential equation \begin{equation} \left[\partial_{\overline{x}}^{4}+2\left(1+\delta\right)\partial_{\overline{x}}^{2}\partial_{\overline{y}}^{2}+\partial_{\overline{y}}^{...
4
votes
1answer
71 views

Weird behaviour of FindMinimum

On Mathematica 12.1, I tried to do FindMinimum[Sin[x] + 1, {x, 55.00000000000001`, 54, 56}, Method -> "PrincipalAxis"] It gives the output ...
1
vote
0answers
60 views

How to get the coefficients of second-order Runge-Kutta formula coherently?

The form of the second order Runge Kutta formula is as follows(the following is from page 287 of this book): $$\left\{\begin{array}{l} y_{n+1}=y_{n}+h\left(c_{1} K_{1}+c_{2} K_{2}\right) \\ K_{1}=f\...
0
votes
1answer
61 views

Error in solving a system of partial differential equations

I'm trying to a solve of system of partial differential equation, but Mathematica is giving some error. Can anyone help me please to find out the error. ...
0
votes
1answer
38 views

Numerical Evaluation Error

Could anyone explain why the evaluation of this gives a weird error? a = 1.11111111111111111111; Do[a = 2 a - a; a, 50]
3
votes
2answers
101 views

How to solve the following delayed differential equations with periodic delay effect?

I want to solve the following differential equations $\partial_{t} f(t) = - a f(t)-a \sum_{n=1}^{N} f(t-n \tau) \cdot \Theta(t-n \tau)$ I learned the way for solving the equations from the following ...
2
votes
1answer
80 views

Smoothen the result of FindRoot

I have a set of code for which it involves finding the corresponding c for each a (although I will give a value of ...
1
vote
0answers
89 views

Why is Mathematica saying this sequence tends to $0$?

I am a complete novice in Mathematica so please bear with me. I am trying to graph a sequence that converges to $\pi$ but after $27$ iterations Mathematica just goes crazy and I am not sure why. I got ...
1
vote
1answer
75 views

How can I determine the convergence rate of recurrence methods?

I want to solve the equation $x^{3}-x-1=0$ by iterating recurrence equations. I have two different recurrence relations for solving this equation: $x_{k+1}=\sqrt[3]{x_{k}+1} \quad(k=0,1, \cdots)$ $...
0
votes
0answers
30 views

Steady state customer behavior in queuing model — Numerical Optimization

With the following code I try to calculate the steady-state equilibrium waiting time at two different queues. A fraction tau of users turns away entriely, a ...
4
votes
3answers
208 views

Geometrically nonlinear beam deflection

Edit only for those interested in large deflections of beams I discovered a mistake in the equations of the original question (below): in the normal force (compression/traction) ...
0
votes
1answer
42 views

Defined function keeps the variable

I'm a beginner at Mathematica, and I have a problem finding the roots of a function for a specific variable (using Jens' findAllRoots function). Due to the nature of my problem, I need to compute ...
4
votes
1answer
124 views

Steady state solution (1D) of nonlinear dispersal equation

Now I'm interested in the equation $$\frac{\partial }{\partial x}\Bigl(\text{sgn}(x) u \Big) +\frac{\partial}{\partial x} \Bigl[ u^2 \frac{\partial u}{\partial x} \Bigr] =0$$ with boundary conditions $...
1
vote
0answers
57 views

NDsolve Boundary Condition is a Function of the Solution

I am trying to solve something like Fick's Law using NDSolve: $$\frac{\partial \varphi}{\partial t}=\frac{\partial^2 \varphi}{\partial r^2}+F(r,t)$$ Subject to a ...
1
vote
0answers
32 views

NIntegrate with AdaptiveMonteCarlo method

I have some complicated function that depends on a few parameters that I need to integrate. It is integrated in the fastest way by using "AdaptiveMonteCarlo" method. However, I have found ...
0
votes
0answers
55 views

Significant digits

I have a rather silly question, so please excuse me=) Let's say I have a general Mathematica code, where I numerically evaluate and combine several quantities. I would like to know how to determine ...
11
votes
2answers
402 views

Nonlinear dispersal equation modeling insect aggregation

I'm a newbie with Mathematica, I know it's a basic answer, but I can't solve the problem on my own. I have the following equation reflecting insect aggregation at low population densities (taken from ...
2
votes
1answer
75 views

Solving the PDE $\partial_t u = \partial_x (u^2 \partial_xu)$

I'm trying to use Mathematica to solve the following equation $$\partial_t u = \partial_x (u^2 \partial_xu)$$ with $$u(0,t)=u(1,t)=0$$ and $$u_0(x)=\sin(\pi x)$$ in order to check a numerical method I ...
0
votes
3answers
99 views

Are these results reliable to make sure that there is a root in FindRoot?

I want to use FindRoot for a 3-variable equation to make sure if there is a root around the point $\{x,2.356\},\{y,0.2\},\{z,0.802\}$ ...
1
vote
1answer
50 views

How to find the p-norm that meets the requirements?

On page 183 of this book there is Theorem 3: In other words, if the spectral radius of a matrix B is less than 1, there must be a norm $ ||B||_{p}$, so that $||B||...
1
vote
2answers
34 views

Expression evaluates to a different number when made a function

The following expression evaluates to zero at large n when just using replacement, but if the same expression is defined as a function ...
2
votes
1answer
68 views

Implementation of Dirichlet-Neumann method

I am new in Mathematica and I was trying to find documentation on the Dirichlet-Neumann and Neumann-Neumann methods (which are part of Domain Decomposition Method), but I couldn't find any. Can ...
3
votes
1answer
133 views

Errors in Lyapunov exponent code

Thanks to the answer by @Chris K I think I have re-expressed the question properly. I have the following equations of motion ...
5
votes
1answer
129 views

Trouble with the shooting method for boundary value problem of a 4th-order ODE

This is a question about the fluid mechanics equation, which is solved by a similarity solution ($f(t)$, here). I'm trying to solve the following boundary value problem with shooting method (taken ...
3
votes
1answer
124 views

Coupled second order differential equation with NDSolve

I am trying to solve a 2nd order ODE to reproduce a plot. Here are the equations: ...
3
votes
2answers
68 views

Coupled PDE with nonlinear coefficients: Changing step size to fix large errors?

After help from user @xzczd I was successful in getting Mathematica to numerically solve my PDE (as you can see in this question). When I give realistic parameters for my differential equation, I see ...
2
votes
1answer
70 views

Difficulty when trying to find roots to high accuracy

I'm working with the logistic map $f(x,\lambda)=4\lambda x(1-x)$, and iterations of the logistic map $f^{(2^n)}(x,\lambda)=f^{(2^{n-1})}(f^{(2^{n-1})}(x,\lambda),\lambda)$. There are some special ...
0
votes
0answers
58 views

System of nonlinearly coupled PDEs

Similar to the question I asked on the Math Stackexchange (in this question), I am interested in solving a nonlinearly coupled system of PDEs. The system of PDEs look like this: $$\begin{align*}\...

1
2 3 4 5
34