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
3
votes
2 answers

How to improve the runtime of this matrix generation loop in python3?

I have code that is simulating interactions between lots of particles. Using profiling, I've worked out that the function that's causing the most slowdown is a loop which iterates over all my particles and works out the time for the collision…
mgmf46
  • 145
  • 1
  • 1
  • 10
3
votes
2 answers

How to convert a symbolic expression to a Octave function from the Symbolic Package?

How to convert a symbolic expression to a Octave function from the Symbolic Package? After installing the symbolic package on octave with pkg install -forge symbolic. Using the symbolic package on octave I may write this: octave> pkg load…
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144
3
votes
1 answer

Preventing underflows when computing log of the probability that a normal sample falls in a certain interval in python

Given two reals x and y, I want to compute the following function in python: log Pr [ x <= t <= y ], where t is sampled from a normal distribution. One naive implementation is to use scipy.stats.norm. np.log(scipy.stats.norm.cdf(y) -…
Pegi
  • 31
  • 1
3
votes
1 answer

Mutable data across the FFI and laziness

Intro I'm wrapping a C numerical library with inline-c; some functions can be passed callbacks to step routines, think optimization or time integration of ODEs. In particular in the native C use the callbacks can operate on contiguous arrays,…
ocramz
  • 816
  • 6
  • 18
3
votes
9 answers

Rounding errors in python

why the order of multiplications can impact the results? Consider the following code a=47.215419672114173 b=-0.45000000000000007 c=-0.91006620964286644 result1=a*b*c temp=b*c result2=a*temp result1==result2 We all know that result1 should be equal…
Mannaggia
  • 4,559
  • 12
  • 34
  • 47
2
votes
1 answer

correctly-rounded double-precision division

I am using the following algorithm for double-precision division and trying to make it correctly rounded in software emulation of floating-point. Let a be the dividend and b is the divisor. All operations are performed in Q2.62. Initial…
2
votes
1 answer

Fastest algorithm for computing 3-D curl

I'm trying to write a section of code that computes the curl of a vector field numerically to second order with periodic boundary conditions. However, the algorithm I made is very slow and I'm wondering if anyone knows of any alternative…
2
votes
1 answer

Why in MATLAB is realmax minus something still equal to realmax?

In MATLAB, if I do realmax - 1000000 == realmax I get a logical 1 (true) as an answer. Why is that?
user6214276
2
votes
0 answers

A = B^n - C^n (Excel VBA: Numerical Methods)

I have date from multiple trials for A, B and C. I have been given the equation: A = B^{n} - C^{n} A,B,C => 0 B>C From the Values of A, B and C I wish to calculate n I have attempted to create a VBA function that calculates n using numerical…
2
votes
2 answers

Quick and Hassle-free Installation & Usage of IT++ library on Linux/Windows?

IT++ is a popular GPL library (proposed to be LGPL but no signs as of now) for scientific computation especially in Telecommunications domain. This was recommended to me by my colleagues. It looks hard to install this piece of library on my…
Loves Probability
  • 929
  • 1
  • 9
  • 15
2
votes
1 answer

Solving first order complex ODE

I have a question about solving the first order complex differential equation. I used Runge-Kutta but the answer does not seem to be right. This is my equation: y'=exp(-2*t)-i*y The results for ODEs are OK but for complex equations it does not…
shimool
  • 39
  • 1
  • 4
2
votes
3 answers

How to operate (fast) on mantissa and exponent part of double or float at c++?

I use c++ for computation of various type of special functions (e.g Lambert function, iteration methods for evaluate inversions etc.). In many cases there is an obviously better approach to work with a mantissa and exponent directly. I found many…
2
votes
2 answers

Fortran COMPLEX calculates different from C++

I have completed a port from Fortran to C++ but have discovered some differences in the COMPLEX type. Consider the following codes: PROGRAM CMPLX COMPLEX*16 c REAL*8 a c = (1.23456789, 3.45678901) a = AIMAG(1.0 / c) WRITE (*, *)…
user1284878
  • 75
  • 1
  • 9
2
votes
2 answers

Given a number series, finding the Check Digit Algorithm...?

Suppose I have a series of index numbers that consists of a check digit. If I have a fair enough sample (Say 250 sample index numbers), do I have a way to extract the algorithm that has been used to generate the check digit? I think there should be…
2
votes
0 answers

Computing the gradient of the non-smooth function e.g. normal density as a function of variance parameters using R function grad

I have a problem with computing a gradient of a non-smooth function using R. To explain the core of my problem, I created a simplified problem. I have a log-likelihood trivariate normal density function where the mean is fixed to be zero and the…
FairyOnIce
  • 2,526
  • 7
  • 27
  • 48
1 2
3
9 10