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
0
votes
0 answers

Surge in energy at start of N-body simulation

I am trying to use an n-body simulation to simulate the collapse of a globular cluster, starting from a point where the bodies all have 0 initial velocities generated in random positions of a sphere of a fixed radius and I am investigating the time…
0
votes
2 answers

Why the the arithmetic of python always return 10 for this function?

The output for this code is always 10. AM I doing something wrong? I also want assistance the negative rational exponent equation for "Vc" let R=10000, C=1e-6, and Vs=10 R= 10000 C= 10**-6 Vs= 10 T= float(R*C) t= float(input("Enter…
0
votes
1 answer

Haskell: Is there a way to use list comprehensions to make a tridiagonal matrix or make mine more efficient?

My goal is to make a tridiagonal matrix in an efficient way using either list comprehensions or a more efficient algorithm but I am fairly new to Haskell. I am attempting to solve boundary value problems using finite difference methods. So I have…
Justin
  • 41
  • 6
0
votes
1 answer

Problems with attempting to code the FFT recursively

I've been attempting to code the FFT lately and have not been able to get correct results on sample problems. As I have coded recursively, debugging has been difficult. This is also my first time working with complex vectors, so it is likely that my…
Heggo
  • 1
0
votes
0 answers

Closing a shape using bezier curves

In my assignment I tried to creat a shape using bezier curves. i used the method of bezier interpolation but because of that im missing the last curve because when i solve the linear equations i assum the second derivative in the edges are 0. I want…
0
votes
0 answers

LinAlgError: Singular matrix when performing polynomial interpolation using monomial basis

Here is my attempt to perform polynomial interpolation with monomial basis B = {1,x,x^2,x^3,...x^n}. I keep getting errors while solving for the coefficients from the linear system cB = f Here are my codes: import numpy as np import…
0
votes
1 answer

I have a question about creating a N x N matrix for polynomial approximation

I want to solve for coefficients {c1,c2,...cn} based on the following relationship: Where the N by N matrix B is a set of monomial basis {1,x,x^2,x^3,....x^n} and fa(x) is the approximation function. If I want to loop through n = [3,10,20,50] and…
0
votes
1 answer

Newton's method with known bounds on the root

I have an equation f(x)=y with the follwing properties: we have an explicit expression for the derivative f' the root is known to be between 0 and 1 (in fact f is defined only in this interval) f is (weakly) increasing I am currently solving this…
0
votes
2 answers

(Computational fluid dynamics) Problem with arrays. Why is my C program outputting -1.#IND00

I have a problem with a program i'm writing in C that solves the 1D linear convection equation. Basically i have initialized an two arrays. The first array (u0_array) is an array of ones with the arrays elements set equal to two over the interval or…
0
votes
0 answers

Integrating between two function with simpson rule

I have a numerical problem. I need to calculate the integral between two functions f1 and f2. I already have the simpson rule for one function. I need help how to find the intercepts between the two function and calculate the integral. F0 =…
0
votes
1 answer

Efficient interpolation implementation

I'm writing an interpolation method without using a library functions which does it directly. The signature of the function is: def interpolate(self, f: callable, a: float, b: float, n: int) -> callable: """ Parameters …
0
votes
1 answer

Functions intersection approximation

Let f1 and f2 be two functions in the range of [a, b], and maxerr the required approximation. They both differentiable and continuous in this range. I should return an iterable of approximate intersection Xs, such that: ∀x∈Xs, |f_1(x) - f_2(x)| <…
0
votes
0 answers

Implementing Laguerre's root finding method

I'm trying to implement robust / stable Laguerre's method. My code works for most of polynomials but for few it "fails". Respectively I don't know how to properly handle "corner" cases. Following code tries to find single root (F64 - 64bit float,…
0
votes
0 answers

Finding RuntimeWarning: overflow encountered in double_scalars while running numerical schemes for fluid dynamic study

i'm writing a code to solve Hyperbolic differential equations with different numerica methods such as Lax-Friederichs, Lax-Wendroff and Upwind scheme. During the calculation i often obtain this type of error: RuntimeWarning: overflow encountered in…
0
votes
2 answers

When should you start treating a quadratic as a linear in numerical root-finding?

I have a set of quadratic coefficients a, b, and c the need to be solved in order to determine the intersection between two graphs on a plane (lets say, a parabola and a line). My problem, however, is that when my parabola is so "stretched out" that…
Gary Allen
  • 1,218
  • 1
  • 13
  • 28