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
1 answer
82 views

Find roots of a system equation involving Bessel functions

I'm trying to find the roots (a_n,b_n) of a system involving Bessel functions. I tried to obtain a list of the n-first roots in mathematics with FindRoot, but I only get one root, how can I get the ...
user avatar
3 votes
0 answers
44 views

First few smallest eigenvalues of a large dense symmetric matrix

I construct a large (say 2000x2000) matrix M whose entries are real random variables drawn from a certain distribution. Most of these values will be nonzero, so <...
user avatar
2 votes
1 answer
79 views

Solving 2D Coupled Nonlinear SO Coupled Equation

I am trying to solve coupled nonlinear SO coupled equations in 2D from the following two papers https://arxiv.org/pdf/2105.08849.pdf and https://arxiv.org/pdf/2109.00491.pdf. They have given an input ...
user avatar
-4 votes
1 answer
67 views

Constructing NxN tridiagonal block diagonal matrix with N is a variable [closed]

Hi please can someone help me writing a program of generating a tridiagonal block matrix with dimension of NxN where N is a variable can be 50, 100, 200, 300...etc , Well I don't know how I'm a ...
user avatar
  • 19
2 votes
3 answers
95 views

How can I solve an equation numerically for a range of x-values and multiple initial root guesses?

The following implicitly defined equation has both real and complex roots: $$ \frac{0.5}{(y + x)^2 - 0.3x^2} + \frac{0.5}{(y - x)^2 - 0.3x^2} - \frac{1}{x^2} = 1 $$ I am trying to solve it numerically ...
user avatar
  • 21
2 votes
1 answer
35 views

Validation of the Laplace inversion and storage in a table or an array

I tried to validate this function from 0 to 50 but it takes very long time, is there a faster way to validate this function for t from 0 to 50 and add them in a list? ...
user avatar
0 votes
1 answer
54 views

Cholesky with complete pivoting?

I'm looking for an implementation of Cholesky decomposition with complete pivoting. It is the lev3pchol.f function added in Lapack 3.2 (working note) It has an ...
user avatar
1 vote
0 answers
98 views

Inverse Laplace in mathematica

I can't even get an inverse Laplace for this expression numerically in mathematica, is there a way to inverse this equation below? I have also tried to use fixt talbot package for a numerical ...
user avatar
3 votes
1 answer
103 views

Orthogonalizing without normalizing part 2

After some searching I couldn't find an existing solution that lets you compute orthogonal (not orthonormal basis) without computing huge performance penalty relative to ...
user avatar
3 votes
5 answers
212 views

Numerical solution of the inverse contour plot

I have a function $f(u,v)$ on some domain of $(u,v)$ and would like to find (numerically) the set of couples* $(u_0,v_0)$ s.t. $f(u_0,v_0)=0$, for instance (just and example to illustrate, in practice ...
user avatar
2 votes
1 answer
57 views

Obtaining numerically and efficiently a large number of zeroes

I'm trying to find zeroes numerically, and wrote a small code (see below). The code works reasonably fast for finding a few zeroes (set parameter Msites=20 and find ...
user avatar
  • 454
4 votes
4 answers
164 views

Cholesky/LDLt that works for singular matrices?

TLDR When given $A=X'X$ decomposition, user298737 works by relying on QRDecomposition on $X$. If we didn't have this decomposition, one could use QR to get full-rank part of $A$ and use Cholesky on ...
user avatar
4 votes
2 answers
135 views

How to define a function to be numeric when the input is purely symbolic

My goal is to have NumericQ[h[j]]=True for any j regardless of whether j may be symbolic with no defined value. Setting NumericQ[h[j_]]=True does not work and as I understand the NumericFunction ...
user avatar
4 votes
4 answers
267 views

Simultaneous nonlinear fitting of two datasets to two trial functions with shared parameters

I'm relatively new to mathematica and stack exchange. Problem Generally my problem concerns finding a simultaneous fit of multiple functions to multiple datasets with shared parameters. I have looked ...
user avatar
  • 43
5 votes
1 answer
76 views

Strange issue with NSolve

Please can someone explain to me why the first of the following fails to run (just spitting back the input without warnings/errors), while the second executes successfully? ...
user avatar
  • 837
3 votes
1 answer
50 views

How to detect the positive solution to this logistic boundary value problem

I am trying to find the positive solution to this nonlinear ODE. Theoretically, it has been proven that this problem has a unique positive solution for lam large. But, Mathematica can detect only the ...
user avatar
  • 103
4 votes
1 answer
117 views

General::munfl: - too small to represent as a normalized machine number error

I've been working on this code and finally got it to a point where it produces something. But there seems to be an underflow problem. I believe this happens when Exp[] is used and tried to fix it to ...
user avatar
  • 405
3 votes
1 answer
96 views

Iterative simultaneous numerical optimization of two functions

p = y 10 - 2 x^2 + 5 x; q = 20 y x - y^2 + 2 x; I want to maximize both functions simultaneously (Maximise p to get x and Maximise q to get y). I know that I could ...
user avatar
  • 41
2 votes
0 answers
54 views

Using a compiled function in NMinimize

I can get NMinimize to work with compiled functions in simple cases. This works with a constraint: ...
user avatar
  • 2,617
0 votes
0 answers
56 views

Vastly different runtime when evaluating $\mbox{}_3 F_2$

This question is a follow-up to a previous question. I am interested in numerically evaluating the hypergeometric functions: ...
user avatar
  • 1,217
5 votes
1 answer
101 views

Mathematica ignores precision requirement when evaluating a Legendre function

Bug persisting through 13.1.0 [CASE:4953269] When attempting to calculate a certain associated Legendre polynomial within a given precision, Mathematica seems to ignore it if the argument is ...
user avatar
  • 1,217
2 votes
2 answers
116 views

Numerically checking if expression is 0

I ended up with the example below after some debugging. An expression at the end, Norm[A . X1 + X1 . A - B] is zero. However, using ...
user avatar
5 votes
1 answer
56 views

Difficulties evaluating the generalised hypergeometric function $\mbox{}_3 F_2$ for specific parameters

I have trouble evaluating the following generalised hypergeometric function: HypergeometricPFQRegularized[{1/2, 1, n/2}, {1 - m, 1 + m}, x] at certain values of $n,...
user avatar
  • 1,217
2 votes
2 answers
127 views

Evaluating sums with spherical Bessel functions

I'm running Mathematica 13.0, student edition, on Windows. In physics, the total scattering cross-section of plane waves off a hard sphere of radius $1$ is $$\sigma(k) = \frac{4 \pi}{k^2} \sum_{l=0}^\...
user avatar
0 votes
0 answers
61 views

Using NeumannValue in finite element method to replace a derivative boundary condition in NDSolve to overcome a computational overflow

I am trying to implement and evaluate the function GeneratePsiOfX. The definition of GeneratePsiOfX is: ...
user avatar
0 votes
1 answer
82 views

NDSolve gives different solutions for different intervals

I try to solve the ODE for the complex function w[t], which looks like ...
user avatar
4 votes
2 answers
130 views

Adding numbers with defined precision produces incorrect result

I've tracked a bug in my code down to the problem of adding two numbers together, with the left argument having machine precision, e.g by 3` . The issue is, if ...
user avatar
  • 557
0 votes
0 answers
53 views

Partial Derivative of Numerical Functions at a point not found

I have a complicated function of 4 different variables that was found using FindRoot and NumericQ?. When I plot the function for the different variables over the relevant range, it appears well ...
user avatar
  • 1
0 votes
0 answers
51 views

Estimating a limit of a sequence by several values

Given first several values of a sequence, e.g., {0.291088365036517,0.34379330139259,0.370496101167372,0.383547058928976,0.389873503208829} I'd like to to find the ...
user avatar
  • 2,443
4 votes
1 answer
108 views

How to remove zero after the comma in a plot

Please, how to remove the 15 zeros after the comma and keep only one digit in the plot below? This is the code for example ...
user avatar
  • 621
6 votes
3 answers
368 views

Linear ODEs with NDSolve

I am trying to solve some first order linear odes. My code is below: ...
user avatar
1 vote
0 answers
51 views

Controlling accuracy for code

So I have a lot of trouble controlling precision and or accuracy with Mathematica. I have tried reading up for it but in the end I get even more confused. Here is my code, it is a little long but it ...
user avatar
  • 635
1 vote
0 answers
33 views

Issue with some floating-point errors and not others

Not looking for a solution necessarily, but just trying to understand why this issue occurrs. I have a 'Do' loop which iterates some algorithm over values of a parameter 'x' with range {x,0,1,0.1} and ...
user avatar
  • 185
2 votes
0 answers
52 views

Speed up numerical evaluation of extremely large expression

I have a large 4x4 symbolic matrix whose components are scalar functions with arguments (t,r,$\theta$, $\phi$) and various parameters. The LeafCount of the purely ...
user avatar
  • 557
2 votes
0 answers
69 views

Evaluating and Plotting 3F2 is very slow

I am interested in certain hypergeometric functions $ G_p(z) = \frac{1}{2} {}_3F_2 \left( \begin{matrix} p & p + 1 & \frac{1}{2} \\ 1 + i & 1 - i & \end{matrix} ;z \right) $ and would ...
user avatar
1 vote
0 answers
46 views

Solving a badly conditioned set of linear equations

I have a numerical high-precision badly conditioned over-constrained set of linear equations that I want to solve. I start out with m=616 equations and ...
user avatar
  • 3,613
0 votes
0 answers
78 views

Numerical integration takes huge time to run

...
user avatar
6 votes
1 answer
275 views

How to shoot backwards using the "Shooting Method"?

This is my first time asking a question on here, and I look forward to and appreciate your help. I believe I have a simple question. I am reading the documentation for the "shooting method" ...
user avatar
  • 71
3 votes
1 answer
79 views

How to handle very numbers that are "too small to represent as a normalized machine number"?

I will preface this by saying that I am not very familiar with Mathematica whatsoever. That is why I am asking this here even though I have found a few forum posts that might provide the solution to ...
user avatar
0 votes
0 answers
60 views

Numerical values of parametric differential equations

I would like to get a list or a table of the numerical values of function ch[s] for a specific s, lets say s1=-10^-4, taking into account the parameters m1, φ. It doesn't seem to work with what i ...
user avatar
  • 31
6 votes
1 answer
148 views

Algorithm for the resolvent of a matrix, and LUBackSubstitution

Suppose A is a complex n x n matrix where n is quite big, given as a numeric array. For many ...
user avatar
  • 4,798
3 votes
2 answers
119 views

Is function MiniMaxApproximation equivalent to Remez algorithm?

I'm looking for function calculating polynomial of best approximation (in sense of uniform norm) to given function $f(x)$ on interval $[a,b]$. I know Remez algorithm doing this. In ...
user avatar
  • 31
0 votes
0 answers
49 views

NSolve just spits out the input functions

I was trying to solve 3 equations with 3 variables with NSolve, however, NSolve didn't really do anything but spitting out the ...
user avatar
  • 13
1 vote
0 answers
126 views

What's the command for high approximation up to 50 digits?

I am trying to find the numerical value of $\displaystyle \sum_{n=1}^\infty \frac{e^{-n^2/\pi^2}}{n^2}$ up to 50 digits. I used ...
user avatar
6 votes
1 answer
97 views

Abs applied with explicit map not giving same result as built in threading

I was making a code change that required me to change some code that looked like Abs[list] to something that looked like ...
user avatar
1 vote
0 answers
90 views

Discrepancy in eigenvalues [closed]

I need to calculate the eigenvalues of a matrix and the parameters are such that there is a large difference (several orders of magnitude) between the entries. Theoretically, the matrix has only one ...
user avatar
4 votes
1 answer
113 views

Solving a nonlinear integral equation

I wonder if Mathematica can be used to numerically solve the following nonlinear integral equation? $\lambda^2(t)-\frac{1}{\lambda^4(t)}+\frac{2}{R_0^2} \int_{R_0}^{R_0+u_0t} R \left[\frac{\lambda^...
user avatar
  • 41
1 vote
0 answers
69 views

Numerical solution for multi-step PDEs

I am trying to numerically solve the following PDEs in MMA (v12.0) $$\partial_u f(x,u) = \left\{\begin{matrix}&-a f(x,u) + b \, \partial_x^2 f(x,u), & 0<u<T\\ &r(x;\alpha_1) \, f(...
user avatar
  • 193
0 votes
1 answer
105 views

Finding local minimum of a 2D potential

I tried to find a local minimum point of a 2D potential U[\[Chi],\[CurlyPhi]] with both FindMinimum and ...
user avatar
  • 13
0 votes
0 answers
48 views

NDSolve overdetermined but I can't see how

Edit: partial answer This confuses me but it is due to some behaviour of pattern matching which just seems wrong to me. An example of the behaviour ...
user avatar

1
2 3 4 5
40