Questions tagged [numerical-analysis]

Numerical analysis is the study of algorithms that use numerical approximation, as opposed to general symbolic manipulations.

263 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
1 answer

Returning 'traditional' notations of functions in the context of fourier interpolation

in numerical analysis we students are obligated to implement code in R that given a function f(x) finds its Fourier interpolation tN(x) and computes the interpolation error $||f(x)-t_{N}(x)||=\int_{0}^{2\pi}$ $|f(x)-t_{N}(x)|^2$ or a variety of…
4
votes
2 answers

When to use DBL_EPSILON/epsilon

The DBL_EPSILON/std::numeric_limits::epsilon will give me the smallest value that will make a difference when adding with one. I'm having trouble understanding how to apply this knowledge into something useful. The epsilon is much larger than the…
monkeyking
  • 6,670
  • 24
  • 61
  • 81
4
votes
0 answers

Properly design a parallel, performance critical numerical code

I am a mechanical engineer by training, and work within a research environment mostly extending a large existing numerical code base of 25+ year old C. I have recently decided I would like to learn how to design a serious piece of scientific…
BrT
  • 619
  • 1
  • 5
  • 15
3
votes
0 answers

Kahan summation and relative errors; or real life war stories of "getting the wrong result instead of the correct one"

I am interested in "war stories" like this one: I wrote a program involving the sum of floating point numbers but I did not use the Kahan summation. The sum was bad_sum and the program gave me a wrong result. A colleague of mine, more versed than…
3
votes
1 answer

Fastest algorithm to calculate the Normalized and Engineering Scientific notation of a number

Test case : 35000 -> a normalized scientific notation of the number would be 3.5 * 10E4 -> the engineering notation would be 35 * 10E3 A simple algorithm that does this would keep dividing the number by 10 until we get the notations required.…
unj2
  • 52,135
  • 87
  • 247
  • 375
3
votes
2 answers

Which way has better accuracy to compute the matrix matrix vector product, A B u?

I want to compute the vector, s = A B u, where s and u are N-dimensional complex vector, A is a N-by-M complex matrix, B is M-by-N complex matrix. Which of the following two ways has better accuracy (more significant digits) when the elements of A,…
3
votes
2 answers

Approximating derivatves and second derivatives of numerical functions in Common Lisp - not working as expected

I tried a very naive approach to aproximate the first derivative of a function in Lisp, and came up with something like this: (defparameter *delta-x* 0.00001) (defun diff (f x) (/ (- (funcall f (+ x *delta-x*)) (funcall f x)) *delta-x*)) So…
PaulM
  • 305
  • 1
  • 8
3
votes
2 answers

I want to stop the code when x is equal to 1

I used Octave to write this code. x=0.0; while (x~=1.0) x=x+0.1; fprintf('x=%20.18f\n',x) pause endwhile I want to stop the code when x is equal to 1. So, I put some code like this x=0.0; while (x~=1.0) x=x+0.1; …
PhilliP
  • 73
  • 1
  • 8
3
votes
1 answer

iteration using the secant method with a tolerance

I am trying to find out how many iterations it takes when I run a secant iteration up to a certain tolerance in maple. However, I am receiving an error code, so if someone could point out where the mistake is in my code, I would really appreciate…
3
votes
1 answer

How to evaluate an alternating series when addends contain rounding errors?

I want to numerically evaluate the transition probability of a linear Birth and Death process where is the binomial coefficient and I am able to evaluate it with an acceptable numerical error (using logarithms and the Kahan-Neumaier summation…
3
votes
0 answers

Java - Numerical Integration of a complex function - Zeta function, Abel-Plana formula

(Note: I found a partial solution. I have pasted the test results at the end) I am looking to numerically integrate an approximation of the zeta function. This is done through what is known as the Abel-Plana formula. The Abel-Plana formula can be…
3
votes
7 answers

Most efficient way to find min and max of a sin/cos curve in C#

Background: I have a function in my program that takes a set of points and finds the minimum and maximum on the curve generated by those points. The thing is it is incredibly slow as it uses a while loop to figure out the min/max based on…
Mike Webb
  • 8,855
  • 18
  • 78
  • 111
3
votes
1 answer

Eigenvalues of sparse matrix using Eigen3

Is there a distinct and effective way of finding eigenvalues and eigenvectors of a real, symmetrical, very large, let's say 10000x10000, sparse matrix in Eigen3? There is an eigenvalue solver for dense matrices but that doesn't make use of the…
Philipp
  • 159
  • 1
  • 9
3
votes
3 answers

Jacobi iteration doesn't end

I'm trying to implement the Jacobi iteration in MATLAB but am unable to get it to converge. I have looked online and elsewhere for working code for comparison but am unable to find any that is something similar to my code and still works. Here is…
1 2
3
17 18