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
8
votes
4 answers

std::pow gives a wrong approximation for fractional exponents

Here is what I mean trying to do double x=1.1402 double pow=1/3; std::pow(x,pow) -1; result is 0 but I expect 0.4465 the equation is (1 + x) ^3= 1.1402, find x.
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
7
votes
2 answers

Is there any quick way to determine first k digits on n^n

I am writing a program where I need to know only the first k (k can be anywhere between 1-5) numbers of another big number which can be represented as n^n where n is a very large number. Currently I am actually calculating n^n and then parsing it…
Eastern Monk
  • 6,395
  • 8
  • 46
  • 61
7
votes
3 answers

What is the minimum number of significant decimal digits in a floating point literal to represent the value as correct as possible?

For example, using IEEE-754 32-bit binary floating points, let's represent the value of 1 / 3. It cannot be done exactly, but 0x3eaaaaab produces the closest value to 1 / 3. You might want to write the value in decimal, and let the compiler to…
xiver77
  • 2,162
  • 1
  • 2
  • 12
7
votes
2 answers

Solving an overdetermined constraint system

I have n real number variables (don't know, don't really care), let's call them X[n]. I also have m >> n relationships between them let's call them R[m], of the form: X[i] = alpha*X[j], alpha is a nonzero positive real number, i and j are distinct…
Radu Dan
  • 73
  • 1
  • 5
7
votes
4 answers

Javascript numerical library - vectors, matrices, determinates, inversion

Is there a reasonable numerical library in pure JavaScript? I'd like array-based vectors, matrices, determinate, and matrix inversion. This is only for small problems, not big ones. I'm aware there are choices in Python, Java, C++, or, oh, perhaps…
Paul
  • 26,170
  • 12
  • 85
  • 119
7
votes
1 answer

How to Solve Linear programming problem using DotNumerics?

I'm really interested in numerical analysis. I have been using DotNumerics Open Source Application. My linear system is the following: 1 * x + 3 * y <= 150 2 * x + 1 * y <= 100 where x >= 0, y >= 0 z = 10 * x + 15 * y I am trying to solve z…
loki
  • 2,926
  • 8
  • 62
  • 115
7
votes
6 answers

How to do numerical integration with quantum harmonic oscillator wavefunction?

How to do numerical integration (what numerical method, and what tricks to use) for one-dimensional integration over infinite range, where one or more functions in the integrand are 1d quantum harmonic oscillator wave functions. Among others I want…
7
votes
2 answers

Schrodinger equation for the hydrogen atom: why is numpy displaying a wrong solution while scipy isn't?

I've written up a piece of code to solve the 1-dimensional Schrodinger equation. While the numpy.linalg.eig() routine has been working fine for the harmonic oscillator, it seems to add one spurious solution for the Coulomb potential. On the other…
7
votes
2 answers

Algorithm for fixed-point multiplication

I'm trying to rescale a timestamp (fractional part of seconds only) from nanoseconds (units of 10^-9 seconds) to the lower half of an NTP timestamp (units of 2^-32 seconds). Effectively this means multiplying by 4.2949673. But I need to do it…
hobbs
  • 223,387
  • 19
  • 210
  • 288
7
votes
5 answers

What is a simple way to find real roots of a (cubic) polynomial?

this seems like an obvious question to me, but I couldn't find it anywhere on SO. I have a cubic polynomial and I need to find real roots of the function. What is THE way of doing this? I have found several closed form formulas for roots of a cubic…
cube
  • 3,867
  • 7
  • 32
  • 52
7
votes
1 answer

use of fft, ifft and fftshift in matlab

I am trying to implement the split-step fourier method to solve the nonlinear schrodinger equation in optics. It basically treats the linear part and nonlinear part separately. It solves the linear part by using fourier transform and the nonlinear…
Physicist
  • 2,848
  • 8
  • 33
  • 62
7
votes
1 answer

Integrate a function that doesn't directly operate element-wise

I'm working on a Matlab script that involves fourth order tensors calculations volume integrals. Let H(r,theta,phi) be the function I want to integrate. Assume that H cannot be obtained by simple operations on r, theta and phi. My problem is that in…
7
votes
1 answer

Saving numerical 2D array to image

Lately I have been doing some numerical method programming in C. For the bug fixing and throubleshooting it's nice to have some visual representation of what is happening. So far I have been outputting areas of array to the standard output, but that…
Rok
  • 494
  • 6
  • 15
7
votes
4 answers

How to use BigInteger in VS 2010

I have been trying to use the BigInteger type, that is supposedly new in .NET Framework 4.0. I don't seem to be able to get to it, and get an error when trying to reference it via Using System.Numerics. Any idea what I'm doing wrong? Sorry if this…
Halfdan Faber
  • 223
  • 1
  • 3
  • 4
7
votes
6 answers

Bounding this program to determine the sum of reciprocal integers not containing zero

Let A denote the set of positive integers whose decimal representation does not contain the digit 0. The sum of the reciprocals of the elements in A is known to be 23.10345. Ex.…
Bobby S
  • 4,006
  • 9
  • 42
  • 61