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
0
votes
1 answer

Numerical Recipes v3.0 and pthread library in C++11

If I compile the following code with the command g++ -std=c++11 Threads.cpp -lpthread -I../Libs/nr30, where nr30 is the library provided by http://www.nr.com/, I obtain no errors: #include #include int main(void) { /* ...…
jackb
  • 695
  • 8
  • 26
-1
votes
1 answer

Wrapping around very large angles to [0,2*PI] adds too big numerical error

In below sample, I try different methods to wrap an angle between 0 and 2 x PI. While doing this to compute cosine of same angles, both methods cause a different amount of numerical error compared to the standard std::cos(original angle that is…
-1
votes
1 answer

issue with converting rate equation to python code

I am trying to convert these rate equations to python code, I have made I lot of research but can't seem to get any clear path to follow to achieve this, please any help will be appreciated This is a newly updated code....i wrote using the quide…
-1
votes
1 answer

Python numerical solution to an exponential function with two variables

I have an exponential function with two known variables, x, and y. I need to find the value of y when I input an x. However, my code could not go through and solve the problem. My function and all relevant constants are given below: import…
Mainland
  • 4,110
  • 3
  • 25
  • 56
-1
votes
2 answers

Small numerical error when calculating Weight Average

Here is a part in a Physics engine. The simplified function centerOfMass calculates 1D-center-of-mass of two rigid bodies (demo) :- #include #include float centerOfMass(float pos1,float m1, float pos2,float m2){ return…
cppBeginner
  • 1,114
  • 9
  • 27
-1
votes
2 answers

Is 0.0 / 0.0 a well-defined value?

Since 0.0 / 0.0 is mathematically undefined, the IEEE-754 floating-point standards reasonably define NaN as its result. Now, because unlike infinity, NaN is not a well-defined value, but a set of values, the question that whether 0.0 / 0.0 is a well…
-1
votes
1 answer

I can't determine the polynomial interpolation with the minumum grade

I have to restrict it with the folowings: P(-1) = f(-1), P(0)=f(0), P(1)=f(1), P'(1)=f'(1)
-1
votes
2 answers

python numerical error: big number add small number

This a exercise from Udacity's Deep learning course. Can anyone explain why the final answer is not 1.0? v1 = 1e9 v2 = 1e-6 for i in range(int(1e6)): v1 = v1 + v2 print 'answer is', v1 - 1e9 # answer is 0.953674316406
Mark5907
  • 411
  • 1
  • 5
  • 16
-2
votes
1 answer

Can I obtain different results from iterative and recurive functions?

My code is supposed to calculate the 100th element of the sequence $x_0=1 ; x_i=\dfrac{x_{i-1}+1}{x_{i-1}+2}, i=1,2, \ldots$ I wrote iterative and recursive functions, but the results are not equal. Is it due to the lost of decimals? Here is my…
-2
votes
3 answers

Solving a non linear equation using the secant method in Fortran

Sooner than expected, I have yet another problem with my Fortran code. This time I'm trying to find the zeros of a function, which I can normally do, but now I have a function that has more than one input: Where gamma, mp and k are just numbers;…
-4
votes
1 answer

How to solve an exponential equation in Python

Now I have an equation to solve: exp(x * a)-exp(x * b) = c, where a,b and c are known constants. I tried sympy and scipy.optimize.fsolve, even brenth and newton. Nothing good. I 'm new to python, like 2 weeks. So pls help me out of this. Thanks!
Kyle
  • 1
  • 1
  • 1
  • 3
1 2 3
9
10