# Questions tagged [numerics]

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

2,234 questions
Filter by
Sorted by
Tagged with
671 views

### NSolve uses all CPU resources

Is it default setting of NSolve that it uses all my four cores of CPU? Be aware that the following code made my computer non-respondent for about 18 seconds till it ...
• 21.3k
145 views

### Using NDSolve to solve the PDEs and their reduced ODEs yields inconsistent results

I am working with a system of coupled PDEs: \begin{align} \partial_tP_x(t,x)&=(\omega_0+\gamma gx)P_y(t,x)-P_x(t,x)/T_2+D\partial_x^2P_x(t,x)\\ \partial_tP_y(t,x)&=-(\omega_0+\gamma gx)P_x(t,x)...
• 451
1 vote
60 views

### Why is the accuracy of NSolve's solutions for equations with multiple roots lower than the accuracy of the original coefficients?

Try the following code ...
• 581
1 vote
46 views

### Entropy Production Rates

I am trying to reproduce the results shown in Fig. 2(a) of the paper https://journals.aps.org/prresearch/pdf/10.1103/PhysRevResearch.6.033037 to calculate entropy production rates in a cavity ...
• 11
1 vote
115 views

### Is it possible to make an ODE-based system component that can be used repeatedly?

The background to my probelm: The problem I want to address is the seismic response of a bridge after installing dampers. The kc component here refers to the ...
• 1,467
143 views

### NSum result quite different from Sum. Euler Maclaurin won‘t work!

I have just computed this finite sum: N[Sum[Sin[1000003451/k], {k, 1, 1000}], 100] And the result is: ...
• 21
45 views

• 2,255
58 views

### How to evaluate Ginsh in Plot3D

I have a function F[x,y] containing multiple polylogarithms $G$ that can be evaluated numerically via GiNaC within the command Ginsh. If say (toy example), ...
• 510
176 views

### Issues in Reproducing Rippling Instability of Graphene using Mathematica from Physical Review B 101, 235428 (2020)

I'm attempting to reproduce the numerical model of the rippling instability of graphene as described in the paper "Physical Review B 101, 235428 (2020)" using Mathematica. Specifically, I'm ...
• 466
298 views

### How to port Matlab/Python's multivariate FoxH implementation in Mathematica?

Ref code MATLAB Python My implementation Are there some mistakes in my Mathematica code? Any help would be greatly appreciated. Attempt Version 1 (❌) ...
• 1,947
81 views

### Generating numerical value for skin friction coefficient

I am trying to generate the numerical values for the skin friction coefficient by using the value of the parameter in the procedure of the attached code. When I run the attached Mathematica sheet code,...
121 views

### Computing norm of a matrix with positive entries

Is there anything in Mathematica that can help me compute norm of a matrix with non-negative entries faster than Norm? Approach below works for ...
• 8,041
78 views

### Numerical values of physical quantities for using in the table of research paper

I am using method of lines for numerical solution of PDEs in mathematica. I have want to find the different numerical values for physical quantities I.e. skin friction coefficient, Nusselt number, and ...
1 vote
117 views

### NDsolve does not solve equation

I have a question for system of ordinary differential equations, because Mathematica does not give the solution. To be more specific, it does not give any sign that there is some problem. There is the ...
89 views

### How to numerically integrate the following expression?

Let fK[T_, D_, t_, H_] := Integrate[(r - t)^(H - 1/2), {r, T, T + D}] fI[T_, D_, s_, u_, H_] := Integrate[((r - u) (r - s))^(H - 1/2), {r, T, T + D}] . I ...
• 155
1 vote
70 views

### Mathematica can't handle expressions with Bessel functions in the limit of a large argument [duplicate]

Consider the following function: ...
• 5,923
129 views

### Why is there a difference between the results using DirichletCondition and directly given boundary condition?

The simulation code ...
218 views

### Numerical derivative of numerical function

I am trying to calculate the derivative of a numerically defined Hamiltonian. This is a minimal working example (on a simple example): ...
• 133
85 views

### Chebyshev Subdomains

The following piece of code creates a grid subdivided into equally spaced Chebyshev subdomains as well as the corresponding differentiation matrix. In this example, we have four subdomains, each with ...
• 535
51 views

### Speed up the evaluation process

I am writing a code to simulate some spins. Following is the main part of the code: ...
• 552
172 views

### Looking for the asymptotic solution of $x \log (x)-(x+n) \log (x-n)=0$

Working this problem on Mathematics Stack Exchange, I very quickly obtained as an estimate of $x$ solution of $$x \log (x)-(x+n) \log (x-n)=0$$ $$x_n^{(0)}=n+\sqrt n+\frac 14 \log(n)+\frac 12 \tag 1$$ ...
• 1,001
452 views

### Why do I get different results for the products of two identical expressions?

I have two expressions with the Gamma function that are identical: ...
• 3,169
104 views

### How to Solve a Piecewise PDE System in Mathematica?

I'm working on a problem involving the transverse vibration of a piecewise beam system. The system consists of two segments with different properties (length, Young's modulus, second moment of area, ...
• 103
91 views

### Demonstration of different Gaussian quadrature

I am doing demonstration about Gaussian quadrature. Any supplementation would be greatly appreciated. Related: Gauss-Legendre and Gauss-Jacobi quadrature, in MATLAB       My question is: The answer ...
• 1,947
1 vote
112 views

### Challenges with High-Order Boundary Conditions in PDEs for Beam Vibration Analysis in Mathematica

I am trying to solve a problem involving the longitudinal vibration of a beam in Mathematica. The beam is fixed at the left end and has a concentrated mass at the right end. The system is subjected to ...
• 103
63 views

### How to efficiently find the series of quasi-normal frequencies using FindRoot?

I want to use FindRoot reproducing the following result in the table 1 of the article "Scalar gravitational perturbations and quasinormal modes in the five-dimensional Schwarzschild black ...
191 views

### Any ideas on how to use NDSolve to solve this nonlinear 2nd order ODE

I can't get to work this code to solve a nonlinear second order boundary value problem. ...
• 333
1 vote
93 views

### When using FindFit to fit a large dataset with multiple sine functions, a step size error occur

My dataset looks like datatandA = Import["dataForQuestionFindFit20240528.csv"]; ListPlot[datatandA] and the corresponding FFT spectrum looks like ...
• 451
234 views

### Singularity or stiff system suspected in ODE that shouldn't have a singularity in the solution range

I am trying to numerically solve the following ODE where I know the value at p[1000]: ...
• 5,117
442 views

### How many solutions does this system have?

Let us consider the system of two transcendental equations ...
• 27.8k
90 views

### How to push the performance of this compiled function

I have the function optvals solving for two variables. For the given example of variables, I need the program to run atmost in a millisecond. The main part of the ...
• 496
1 vote
90 views

### How to speed up generating and filtering large lists of numbers?

I have the following code where I brute force search for two variables. list gives a list of 3 dimensional vectors, say {x,y,z}. ...
• 496
1 vote
370 views

### Gillespie (stochastic simulation) algorithm

I want to apply the Gillespie algorithm to a set of reactions. First, I run the source code presented here, and then run my model: ...
33 views

### Getting better answers by smaller working precision?

I have the following code ...
• 496
1 vote
67 views

### Numerically solving coupled 2rd ODE with tiny numbers

I am solving the initial value problem of two coupled ODEs numerically. The equations are ...
• 31
1 vote
49 views

### NMaximize doesn't satisfy constraints

I have the following code; ...
• 496
1 vote
99 views

### I can't get NSolve to work

I have defined the function ekert the following way; ...
• 496
1 vote
75 views

### Problems with implementation of subresultant pseudo-remainder sequence in Sturm's theorem

I've implemented the subresultant pseudo-remainder sequences ( https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Pseudo-remainder_sequences ) as described in Wikipedia. However, when ...
• 111
44 views

### ContourPlot does not draw intersection point and draws ragged plots [closed]

I have the following implicit equation:  M^{-2\frac{\gamma-1}{\gamma+1}}(r)+\frac{\gamma-1}{2}M^{\frac{4}{\gamma+1}}(r) = \frac{g(r)}{g_0}\left( M_0^{-2\frac{\gamma-1}{\gamma+1}}+\frac{\gamma-1}{2}...
• 4,016
33 views

### Making NSum faster with higher precision and accuracy

I have the following code that I want to run to obtain a cumulative list out of various values of s1=3 to s1=10 (say) for the ...
• 411
131 views

### Properly define function from outcome of NSolve and FindRoot

We have the function $\gamma(u,v)$ defined implicitly as the solution of \begin{align} \sin\gamma(u,v)=g\left(u-v\cos\gamma(u,v) \right), \end{align} being $g$ a given function. I can solve for \$\...
261 views

### How to make Mathematica plot for a very small region?

I have the following data that I would like to plot using ListPlot. ...
• 411
1 vote
74 views

### How can I ask Mathematica to give the explicit real form of the given function?

In part of my calculations, I obtain this expression which contains the imaginary unit I but I expect that this expression might be real (from the comments below, ...
• 195
52 views

### Ising Model Simulation Increase Efficiency

I implemented a 2d simulation of Ising Model for zero external magnetic field. Below you can find the function I wrote to calculate the energy (periodic conditions) ...
61 views

### Tan function problem [closed]

Why does the Tan function give values for 0, and 30 Degree, but not for the others? Strange behavior? In[16]:= Tan[0 Degree] Out[16]= 0 In[23]:= Tan[10 Degree] Out[23]= Tan[10 °] In[24]:= Tan[20 ...
• 199
1 vote