Questions tagged [numerical-methods]

Algorithms which solve mathematical problems by means of numerical approximation (as opposed to symbolic computation).

Numerical methods include the study of algorithms that use numerical approximation (as opposed to general symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). Numerical methods naturally find applications in all fields of science and engineering, and include implementations of many important aspects of computation including: solving ordinary and partial differential equations, numerical linear algebra, stochastic differential equations, Markov chains, and so forth.

Numerical methods use several approaches to calculate observables. For example, iterative methods that form successive approximations that converge to the exact solution only in a limit. A convergence test, often involving the residual, is specified in order to decide when a sufficiently accurate solution has (hopefully) been found. Examples include Newton's method, the bisection method, and Jacobi iteration. Another example is the use of discretization, a procedure that is used when continuous problems must sometimes be replaced by a discrete problem whose solution is known to approximate that of the continuous problem.

The field of numerical methods includes many sub-disciplines. Some of the major ones are:

  • Computing values of functions

  • Interpolation, extrapolation, and regression

  • Solving equations and systems of equations

  • Solving eigenvalue or singular value problems

  • Optimization

  • Evaluating integrals

  • Differential equations

2104 questions
4
votes
2 answers

Numerical differentiation using 9 data points

I have problems when I'm trying to do numerical differentiation in Matlab. But my question might me more about numerical analysis than about Matlab. I have an array with 9 data points that represents f(x) for 9 different x. I need to find f''(x)…
DoubleTrouble
  • 902
  • 2
  • 7
  • 19
4
votes
2 answers

printing the function name in fortran 90

I wrote a code that finds the root of a function whose name is provided among the arguments, I think I took it from Numerical Recipes. Something like double precision function rtsafe(x_init, x1, x2, xacc, func, dfunc) where func and dfunc are two…
simona
  • 2,009
  • 6
  • 29
  • 41
4
votes
2 answers

Newtons Method in Python

I'm writing a program in python that will solve for zeros using newtons method. I finished writing the rough version of it, then realized a couple different things and was wondering if I need to impement/change this. (knowledge of the subject may…
Shantanu
  • 504
  • 5
  • 15
4
votes
3 answers

Finding maxima in a vector using MATLAB

i'm trying to find local maxima of a vector of numbers using MATLAB. The built-in findpeaks function will work for a vector such as: [0 1 2 3 2 1 1 2 3 2 1 0] where the peaks (each of the 3's) only occupy one position in the vector, but if I have a…
kazimpal
  • 270
  • 3
  • 13
4
votes
1 answer

Variable radius Gaussian blur, approximating the kernel

I'm writing a Gaussian blur with variable radius (standard deviation), i.e. each pixel of the image is convolved using a different kernel. The standard techniques to compute Gaussian blur don't work here: FFT, axis-separation, repeated box-blur—they…
Yakov Galka
  • 70,775
  • 16
  • 139
  • 220
4
votes
3 answers

Is there any numerical-accurracy difference on calculating sin(pi/2-A) and cos(A) in Matlab?

I am reading a matlab function for calculating great circle distance written by my senior collegue. The distance between two points on the earth surface should be calculated using this formula: d = r * arccos[(sin(lat1) * sin(lat2)) + cos(lat1) *…
4
votes
1 answer

Efficient/Cheap way to concatenate arrays in Julia?

In Julia, I would like to concatenate several arrays (and also multiply them). Within my program, I have written it as follows: [Uᵣ Qₐ]*Uₖ [Vᵣ Qᵦ]*Vₖ However, this array concatenation is very expensive compared to the rest of the program I have…
4
votes
1 answer

Why should I use normalised units in numerical integration?

I was simulating the solar system (Sun, Earth and Moon). When I first started working on the project, I used the base units: meters for distance, seconds for time, and metres per second for velocity. Because I was dealing with the solar system, the…
4
votes
1 answer

Numeric precision for log(1-exp(x))

I'm doing some math with really big numbers (I'm using Python, but this question isn't Python specific). For one value, I have a formula that gives me f(t) = Pr(X < t). I want to use this formula to get Pr(X >= t) = 1 - f(t). Because f(t) returns…
user
  • 7,123
  • 7
  • 48
  • 90
4
votes
1 answer

Complex floating point types

I'm implementing my own programming language for fun, and have been playing around with the implementation of various floating point numeric types. I'd like to think about implementing a numeric type to represent complex numbers. i) I've been…
Sam Roberts
  • 23,951
  • 1
  • 40
  • 64
4
votes
1 answer

How to speed up this for loop containing kronecker product?

I want to speed up the following for loop. % Use random matrices for testing. % Elapsed time of the following code is around 19 seconds. % So, when N is large, it's very slow. n= 800; N =100; k =10; x = rand(n,N); S = rand(k,N); H = 0; for i = 1:…
learner
  • 151
  • 1
4
votes
1 answer

Finding the elbow point of a curve in a stable way?

I am aware of the existence of this, and this on this topic. However, I would like to finalize on an actual implementation in Python this time. My only problem is that the elbow point seems to be changing from different instantiations of my code.…
Legend
  • 113,822
  • 119
  • 272
  • 400
4
votes
2 answers

Tolerance criteria Brent's method

Stop criteria for Brent's method is if abs(m) <= tol or fb == 0.0 then // root found (interval is small enough) found := true; However, what if abs(m) reaches below said tolerance but the value of f(b) is no where close to zero? Will this…
4
votes
2 answers

Numerically calculate combinations of factorials and polynomials

I am trying to write a short C++ routine to calculate the following function F(i,j,z) for given integers j > i (typically they lie between 0 and 100) and complex number z (bounded by |z| < 100), where L are the associated Laguerre Polynomials: The…
fromGiants
  • 474
  • 1
  • 7
  • 16
4
votes
0 answers

Trust region algorithm implementation in dlib

I was watching the trust region algorithm implementation in the dlib code, optimization_trust_region.h, where it is stated that it is stated that "This is an implementation of algorithm 4.3 (Trust Region Subproblem) from the book Numerical…
Dan
  • 51
  • 4