Questions tagged [numerical-computing]

Is an interconnected combination of computer science and mathematics .

Is an interconnected combination of computer science and mathematics in which we develop and analyze algorithms for solving important problems in science, engineering, medicine, and business, for example, designing a bridge, choosing a stock portfolio, or detecting tumors in medical images

146 questions
1
vote
0 answers

Checking subtraction cancellation (floating point precision)

When reading about numerical methods, then subtraction cancellation is often a topic. Simple example of cancellation: a = 1; b = 1e-16; a-(a+b) = 0 hence we loss all information of b. However, i rarely read about how to check for this problem.…
jsjq
  • 51
  • 4
1
vote
1 answer

MATLAB Class Efficiency

I try making it short. I got a problem involving numerical simulation of a flow withing a gas pipe. I simulate using different models for the air flow (transport equations) travelling from one boundary to the other (i.e. from right to left). The…
1
vote
0 answers

How to compute log(exp(x)-exp(y)) numerically stable

I'm trying to compute log(exp(x)-exp(y)); since this is not sum anymore, I can't use LogSumExp and things can still get very ugly if exp(x) or exp(y) is large (e.g.) exp(32) or something). How do I do this more safely?
ElleryL
  • 507
  • 7
  • 16
1
vote
1 answer

Is it more computationally strenuous to compute an exponential or a Bessel function?

It is often desirable to obtain the solution to a mathematical problem in closed form, that is, as an expression that contains generally-accepted functions like polynomials, rational and irrational functions, roots, and exponentials and logarithms.…
ToniAz
  • 430
  • 1
  • 6
  • 24
1
vote
2 answers

How to split diagonal matrix into equal number of items each along one of axis?

I have a very large diagonal matrix that I need to split for parallel computation. Due to data locality issues it makes no sense to iterate through the matrix and split every n-th calculation between n threads. Currently, I am dividing k x k…
sophros
  • 14,672
  • 11
  • 46
  • 75
1
vote
2 answers

How to find coefficients of polynomial equation?

Given two points in the x, y plane: x, f(x) 1, 3 2, 5 I can interpolate them using Lagrange and find f(1.5), which result in 4. Thinking a little I managed to find a way to discover the coefficients of the equation: void l1Coefficients(const…
KcFnMi
  • 5,516
  • 10
  • 62
  • 136
1
vote
0 answers

Numerical strategy to calculate a fraction sometimes very close to zero

In the R function chisq.test() there is the following line: PVAL <- (1 + sum(ss >= almost.1 * STATISTIC))/(B + 1) with almost.1 <- 1 - 64 * .Machine$double.eps This is clearly a computational adjustment to avoid getting round outputs for PVAL. It…
Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114
1
vote
0 answers

split step Fourier method in Python

Sorry that this post is long but I am trying to simulate two dimensional Schrodinger equation in python using split-step method. One dimensional problem of this equation has been explained in this…
A.E
  • 997
  • 1
  • 16
  • 33
1
vote
1 answer

Is numerical error reproducible?

Perhaps this is a dumb question, but I've never thought about it until I was just recently forced to. Assume a program is initialized with the exact same state and no undefined behavior in the way of uninitialized variables. Register states on the…
user650261
  • 2,115
  • 5
  • 24
  • 47
1
vote
2 answers

Smart way to make efficient wrapper for a performance library

Suppose, we have an external library that can do calculations very fast (most of the times multithreaded) on an array of double precision floating point numbers. For convenience, I write my code in an object oriented way so I get an array of…
Zoltán Csáti
  • 679
  • 5
  • 17
1
vote
0 answers

Is MATLAB's implementation of LAPACK calls more efficient than straight calling?

I'm trying to make a C version of many of the things I have in MATLAB, and I timed the eigenvalue decomposition using matlab's eig vs a dsyev call, and MATLAB's is faster. For example: 10 x 10: 0.003246 seconds with eig, 0.013897 s with dsyev in…
Y. S.
  • 253
  • 2
  • 7
1
vote
1 answer

Matlab doesn't output the numerical solution of a equation (instead output ``Rootof some polynomials'' )

I am trying to solve the following equation numerically under Matlab2014b environment.However matlab does not output numerically solutions, it instead output the following >>solve(1/beta(13,11)*x^(12)*(1-x)^(10)==1.8839,x) RootOf(z^11 - 5*z^10…
1
vote
3 answers

Efficiency of manually written loops vs operator overloads

in the program I'm working on I have 3-element arrays, which I use as mathematical vectors for all intents and purposes. Through the course of writing my code, I was tempted to just roll my own Vector class with simple arithmetic overloads (+, -, *…
Mike Bailey
  • 12,479
  • 14
  • 66
  • 123
1
vote
2 answers

get vector which's mean is zero from arbitrary vector

as i know to get zero mean vector from given vector,we should substract mean of given vector from each memeber of this vector.for example let us see following example r=rand(1,6) we get 0.8687 0.0844 0.3998 0.2599 0.8001 …
user466534
1
vote
1 answer

A Classical Numerical Computing MATLAB code

f(x) = (exp(x)-1)/x; g(x) = (exp(x)-1)/log(exp(x)) Analytically, f(x) = g(x) for all x. When x approaches 0, both f(x) and g(x) approach 1. % Compute y against x for k = 1:15 x(k) = 10^(-k); f(k) =(exp(x(k))-1)/x(k); De(k) =…
user1532230
  • 157
  • 1
  • 2
  • 7