Skip to main content

Questions tagged [numerics]

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

Filter by
Sorted by
Tagged with
7 votes
3 answers
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 ...
azerbajdzan's user avatar
  • 21.3k
3 votes
1 answer
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)...
so_sure's user avatar
  • 451
1 vote
1 answer
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 ...
lapcal's user avatar
  • 581
1 vote
0 answers
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 ...
Ramzan's user avatar
  • 11
1 vote
1 answer
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 ...
xinxin guo's user avatar
  • 1,467
2 votes
1 answer
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: ...
Teller's user avatar
  • 21
0 votes
0 answers
45 views

How to solve numerically a fourth order BVP having a Boundary condition at Limit Approaches to 0

I have the following fourth order BVP (pde): $\frac{1}{4}f_{yyt}+H^{4}(ff_{yyy}-f_{y}f_{yy})=\frac{1}{H^{2}R}(yf_{yyy}+2f_{yy})$ with boundary conditions: $f(0,t)=0$, $f(1,t)=0$, $f_{y}(1,t)=-\frac{\...
Junaid Ahmad's user avatar
0 votes
0 answers
74 views

Second derivative from dataset or graph

I have a graph obtained from the eigenvalues of a matrix. I want the second derivative of each line (there are 3 independent curves in the graph) in specific ranges. Could you please help me? One way ...
asato's user avatar
  • 41
11 votes
1 answer
352 views

How to get inverse matrix for large size matrix in Mathematica?

Solutions to Hundred-dollar, Hundred-digit Challenge problems can be found easily: Mathematica (MathWorld Notebook) Python I'm trying to solve the 7th problem: Let A be the 20000×20000 matrix whose ...
138 Aspen's user avatar
  • 1,947
2 votes
2 answers
84 views

Differential equation's result under Robin boundary conditions are significantly different from those under direct given conditions

...
liaotianjun's user avatar
0 votes
1 answer
25 views

`NMinimize` provides wrong answer when `WorkingPrecision` is specified

I'm trying to use NMinimize to solve the 4th question of Hundred-dollar, Hundred-digit Challenge problems What is the global minimum of the function $\exp(\sin(50x)...
Jie Zhu's user avatar
  • 2,255
0 votes
0 answers
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), ...
CAF's user avatar
  • 510
4 votes
0 answers
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 ...
Ferca's user avatar
  • 466
4 votes
1 answer
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 (❌) ...
138 Aspen's user avatar
  • 1,947
2 votes
1 answer
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,...
Tariq hussain's user avatar
3 votes
1 answer
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 ...
Yaroslav Bulatov's user avatar
0 votes
0 answers
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 ...
Tariq hussain's user avatar
1 vote
2 answers
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 ...
Miroslav Jovic's user avatar
2 votes
1 answer
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 ...
Mr Frog's user avatar
  • 155
1 vote
1 answer
70 views

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

Consider the following function: ...
John Taylor's user avatar
  • 5,923
2 votes
2 answers
129 views

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

The simulation code ...
liaotianjun's user avatar
2 votes
2 answers
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): ...
blahblah's user avatar
  • 133
0 votes
0 answers
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 ...
user12588's user avatar
  • 535
0 votes
0 answers
51 views

Speed up the evaluation process

I am writing a code to simulate some spins. Following is the main part of the code: ...
P Pyne's user avatar
  • 552
3 votes
3 answers
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$$ ...
Claude Leibovici's user avatar
6 votes
3 answers
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: ...
Vaclav Kotesovec's user avatar
0 votes
2 answers
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, ...
Mikoto's user avatar
  • 103
2 votes
0 answers
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 ...
138 Aspen's user avatar
  • 1,947
1 vote
1 answer
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 ...
Mikoto's user avatar
  • 103
0 votes
0 answers
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 ...
Robert Xu's user avatar
2 votes
1 answer
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. ...
complex's user avatar
  • 333
1 vote
1 answer
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 ...
so_sure's user avatar
  • 451
5 votes
3 answers
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]: ...
ydd's user avatar
  • 5,117
6 votes
3 answers
442 views

How many solutions does this system have?

Let us consider the system of two transcendental equations ...
user64494's user avatar
  • 27.8k
2 votes
0 answers
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 ...
Dotman's user avatar
  • 496
1 vote
1 answer
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}. ...
Dotman's user avatar
  • 496
1 vote
1 answer
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: ...
user avatar
0 votes
0 answers
33 views

Getting better answers by smaller working precision?

I have the following code ...
Dotman's user avatar
  • 496
1 vote
0 answers
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 ...
Link's user avatar
  • 31
1 vote
1 answer
49 views

NMaximize doesn't satisfy constraints

I have the following code; ...
Dotman's user avatar
  • 496
1 vote
2 answers
99 views

I can't get NSolve to work

I have defined the function ekert the following way; ...
Dotman's user avatar
  • 496
1 vote
0 answers
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 ...
Moonwalker's user avatar
0 votes
1 answer
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}...
atapaka's user avatar
  • 4,016
0 votes
0 answers
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 ...
QFTheorist's user avatar
0 votes
3 answers
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 $\...
Daniel Castro's user avatar
4 votes
3 answers
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. ...
QFTheorist's user avatar
1 vote
0 answers
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, ...
MsMath's user avatar
  • 195
0 votes
0 answers
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) ...
Gianmarco Morbelli's user avatar
0 votes
1 answer
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 ...
user3584513's user avatar
1 vote
0 answers
61 views

Adapt Code to Solve Fractional-Order System Delay Differential Equations- Chen System

Dynamics of fractional-ordered Chen system with delay I have tried to modify this code ...
FQL's user avatar
  • 11

1
2 3 4 5
45