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
5 votes
3 answers
327 views

How many solutions does this system have?

Let us consider the system of two transcendental equations ...
user64494's user avatar
  • 26.6k
2 votes
0 answers
80 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
  • 456
0 votes
1 answer
71 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
  • 456
0 votes
0 answers
222 views
+250

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: ...
A novice's user avatar
  • 155
0 votes
1 answer
72 views

How does FindRoot work?

I have a system of 3 nonlinear equations in 3 unknown variables $f(x,y,z)=0, g(x,y,z)=0, q (x,y,z)=0$. I want to find $(x,y,z)$ that satisfies the 3 equation so I input: FindRoot[$\{f[x,y,z], g[x,y,z],...
Engineer's user avatar
  • 119
0 votes
0 answers
28 views

Getting better answers by smaller working precision?

I have the following code ...
Dotman's user avatar
  • 456
1 vote
0 answers
63 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
0 votes
1 answer
45 views

NMaximize doesn't satisfy constraints

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

I can't get NSolve to work

I have defined the function ekert the following way; ...
Dotman's user avatar
  • 456
1 vote
0 answers
66 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
39 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
  • 3,954
0 votes
0 answers
31 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
124 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
238 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
71 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
41 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
60 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
57 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
0 votes
1 answer
54 views

NSum with variable sitting inside

I want to evaluate the following and many other similar expressions numerically from k=2 to k=Infinity with a variable ...
QFTheorist's user avatar
0 votes
0 answers
42 views

NSolve produces large coefficients in Roots[...] result

I'm attempting to plot a function's derivative approximation but encountering numerical errors. The issue seems to stem from NSolve generating large coefficients. I'm unsure how to fix it. Any advice ...
Moonwalker's user avatar
0 votes
1 answer
96 views

Components of Faraday tensor

Maybe it's a very basic physics question but I'm confused and not sure if I should ask my question here. From this paper, I have the potential vector $$ A=A_t d t+A_\phi(d \phi-\omega d t) $$ where $$ ...
Dayzk's user avatar
  • 147
0 votes
2 answers
76 views

Generating lists where new elements depend on the previous element

I am interested in using some type of list or table in-built Mathematica function to generate a list, where the elements of the new list not only depends on the input values of a previously defined ...
John Doe's user avatar
  • 279
4 votes
1 answer
201 views

Fourier Transform of 2D data using Fourier

I don't understand the documentation of Fourier. My goal is the get the coefficients of the Fourier-series (i.e. $\sum_{n\in \mathbb{Z}} c_{n,m} e^{inx+imy}$) of ...
Confuse-ray30's user avatar
0 votes
1 answer
58 views

HypExp package throwing errors when loading

I am trying to load the package HypExp by using the instructions given on the site. The package throws an error ...
QFTheorist's user avatar
1 vote
0 answers
61 views

(N)Solve does not solve a linear system of $2l+1$ variables for $l\geq17$

(MMA v. 14.0, and 13.0) This is a strange behaviour I encountered when trying to determine Fourier coefficients in the most naive way: ...
Confuse-ray30's user avatar
1 vote
0 answers
92 views

Implementation of a cavitation model

Problem formulation Hi, I'm following this reference and I am trying to reproduce Fig. 19: The problem concerns an underwater shockwave, which hits the water-surface and produces a cavitation region. ...
MOOSE's user avatar
  • 169
5 votes
1 answer
280 views

Mathematica stuck for more than 12 hours on getting numerical value

The following expression when summed from $k=0$ to $\infty$ converges but returns an absolutely hideous expression that I cannot fit in here due to the character limit. I want the numerical value up ...
QFTheorist's user avatar
3 votes
2 answers
95 views

Does NDEigensystem work in dimensions greater than 3?

I have been trying to run NDEigensystem on a differential operator with four variables $\alpha$, $\beta$, $\gamma$, and $\delta$. I've found that if I run the ...
NOABM's user avatar
  • 33
2 votes
1 answer
115 views

Graph of an ergoregion

I'm trying to graph the region defined by the following equation (which comes from the $g_{00}$ element of the metric (2.1) in this paper) $$ g_{00}=-f H+H^{-1} \omega^2 r^2 \sin ^2 \theta $$ which in ...
Dayzk's user avatar
  • 147
1 vote
0 answers
86 views

Numerical computation of a loan and numerous parameters

I'm not an expert of Wolfram Language, but I'd like to create a simple way to solve a financial problem maybe not very straightforward as it involves numerical computation, numerous variables and a ...
Pepus's user avatar
  • 11
2 votes
1 answer
73 views

Inconsistent results when trying to solve an ordinary differential equation (ODE)

Introduction and problem I tried to solve, symbolically and numerically, the following ODE with Mathematica: $y’(t) = \sin(t) y’’(t)$, and I got strange results at different levels (either ...
mlpo's user avatar
  • 879
2 votes
1 answer
106 views

NDSolve returns answer not satisfying initial conditions given to it

I have a (fairly) complicated Lagrangian that I'm trying to solve numerically in Mathematica. The first part, generating the equations of motion, works fine, but I've included them here for the sake ...
ScienceSnake's user avatar
8 votes
3 answers
532 views

Basins of attraction using Newton-Raphson method for nonlinear system

I am trying to construct basins of attraction using the newton's method for the system of two equations whose roots are real. I need to develop a code to get basin of attraction. Unfortunately, my ...
onk's user avatar
  • 119
11 votes
1 answer
556 views

Why is Mathematica showing a root twice from Reduce or Solve?

If we plot the following, we can see there are seven roots Plot[{x, 3 Pi (1 - Sin[x])}, {x, 0, 22}] We can easily solve for these roots ...
Moo's user avatar
  • 3,334
0 votes
0 answers
30 views

Numerical integrate a matrix valued function whose arguments limited to be numerical

I'm encountering non-numerical errors when using NIntegrate to integrate a matrix-valued function whose arguments are restricted to numerical values. Setting ...
ssskkkky's user avatar
6 votes
2 answers
198 views

Numerical solution of PDE with nonstandard boundary condition

I wonder if Mathematica can handle following pde in two-dimension I have tried following but got errors. I need numerical solution of the problem on line y equal to zero. Any help appreciated.
Merakli's user avatar
  • 63
4 votes
3 answers
197 views

Solving where an Interpolating Function crosses a Region Boundary

I have a function which takes in a parameter t and outputs a point {x, y}, which together describe a continuous and smooth curve....
ScienceSnake's user avatar
3 votes
1 answer
122 views

Solve for nonlinear problems [closed]

I am unable to draw the figure below which is taken from paper. However I can draw velocity curves (graphs) using the given code in Mathematica. using equation 16 Any help would be appreciated!
M. Mubashir's user avatar
3 votes
0 answers
74 views

Which Method does NDSolve use when solving a pde?

In this example F = NDSolveValue[{Derivative[2, 0][f][x, y] == y^2*f[x, y],f[1, y] == 1, Derivative[1,0][f][1, y] == 1}, f, {x, 0, 1}, {y, 0, 1}] ...
Ulrich Neumann's user avatar
1 vote
0 answers
83 views

How to efficiently calculate matrix operations when the elements are defined as functions?

I'm trying to calculate the one-body density matrix of a system of particles as described in this article, given in equations 14 and 15. Here, is my code but it seems very slow. Is there any efficient ...
sudipta's user avatar
  • 63
0 votes
0 answers
76 views

Initial conditions making trouble with NDSolve

I want to solve a number of differential equations in a single NDSolve. The code is as follows: ...
Julian Yussef's user avatar
0 votes
2 answers
116 views

What is the value of this integral?

Let us consider the definite integral $$\int\limits_0^1\frac{1}{-\sin \left(\frac{355 x}{113}\right)-\sin (\pi x)+2}\,dx.$$ The integrand has the sharp maximum at approximately ...
user64494's user avatar
  • 26.6k
1 vote
3 answers
103 views

Any quick way to get a y(x) that satisfies g(y(x))=f(x)?

I have two different functions f(x) and g(y). Is there a quick way to create some numerical function ...
L. P.'s user avatar
  • 101
0 votes
3 answers
73 views

How to Plot in a tiny interval, avoiding "must have distinct machine-precision numerical values" error?

Edit even simpler example which appears impossible to make work: Plot[x, {x, 1, 1 + 10^-13}] The following code fails with ...
Yaroslav Bulatov's user avatar
0 votes
2 answers
75 views

Estimating float32 precision loss

What's the correct way to using Mathematica to get location of true value when using IEEE-754 float32 precision? Inspired by this question, where the user got a range of different answers when asking ...
Yaroslav Bulatov's user avatar
2 votes
2 answers
121 views

How can I enforce the use of Subtract and Divide?

It has been noted before, here and here, that when you enter a/b or a-b, Mathematica does not convert these to ...
Felipe's user avatar
  • 499
6 votes
1 answer
133 views

Avoiding artificial diffusion and minimize changes to code

I am currently working through Solving Partial Differential Equations with Finite Elements specifically the fluid flow problems. I took the Stokes flow problem and replaced it with Euler's equations ...
Kendall's user avatar
  • 363
1 vote
0 answers
168 views

How to Model a Parametric Fast Fourier Transform in Mathematica?

I'm using this code which evaluates the FFT of my original signal (which is a time series). Using the Manipulate function of Mathematica it is possible to vary the ...
Giuseppe Vonella's user avatar
1 vote
1 answer
67 views

Using ParametricNDSolve does not work for certain parameters

I want to solve the following second-order DE $$ \ddot{w}(t) H(w(t))+\frac{1}{2}(\dot{w}(t))^2 H'(w(t))+g(w(t))(c_0 (\overline t-\underline t)-w(t)) =0, $$ with boundary conditions $\dot{w}(\overline ...
Jerome P.'s user avatar
0 votes
0 answers
127 views

NDSolve gives High Oscillatory Solution [duplicate]

I want to solve a differential equation of second order with complex initial conditions. ...
Jules Alvarez's user avatar

1
2 3 4 5
45