Category "math"

Interpreting formulas with ΣΣ (two sigma) in Python

Consider the function f(x,y) that equals two sigma (ΣΣ) where i ranges from 1 to 10 and (first sigma) and j ranges from 1 to 10 (second sigma) of th

Formula to calculate adjusted close price like yahoofinance in python

So, I have been trying to create a manual function in python that calculates the adjusted closing price of stocks using dividends and stock splits data but I co

PHP: How to raise number to (tiny) fractional exponent?

I'm doing a calculation in PHP using bcmath, and need to raise e by a fractional exponent. Unfortunately, bcpow() only accepts integer exponents. The exponent i

algorithm to merge two arrays into an array of all possible combinations

Example given in JavaScript: Suppose we have two arrays [0,0,0] and [1,1,1]. What's the algorithm to produce all possible ways these two arrays can be combine.

Basic example of how to do numerical integration in C++

I think most people know how to do numerical derivation in computer programming, (as limit --> 0; read: "as the limit approaches zero"). //example code for d

How to calculate the range of data type float in c++?

As we can see int has 4 byte in memory, that are 32bits, after applying range formula , we can see range of int -2147483648 to 2147483647. I have calculated the

Formula to make the ends of the arms of a spiral galaxy less dense

I want to make a spiral galaxy in Unity 3D using C# ( i use a derived logarithmic spiral ). I want to set the end of the arms less dense than the middle, but mi

Why is my rock/paper/scissors game getting the same random number for multiple function calls?

I have made a functioning (if possibly extremely verbose) game of rock/paper/scissors. If I run the game by calling the function once over and over the 'compute

Is there any way to get the step-by-step solution in SymPy?

Is there any way to get the step-by-step solution in SymPy? For example: x**2-5 = 4 step 1 x**2-5+5=4+5 step 2 : x**2=9 step 3 :x = 3 or x= -3

Trying to create point from X,Y, coordinate

I have used a formula to create an X and Y coordinate that I would like to create a point from. They are held in the attribute table, and I don't know how to us

how to get the slope of a linear regression line using c++?

I need to attain the slope of a linear regression similar to the way the Excel function in the below link is implemented: http://office.microsoft.com/en-gb/ex

Correct implementation of SI, SIS, SIR models (python)

I have created some very basic implementations of the mentioned models. However, although graphs seem to look right, the numbers don't add up to a constant. Tha

Fibonacci Numbers - Add odd numbers only - Javascript

So I am trying to develop a formula that will sum all odd Fibonacci numbers up to and including a given number. For example: Given number is 4. Then result sh

Why XOR of all subsets of a list have same frequency?

I have a list of numbers a1, a2, a3, a4, a5, ... and so on. If we find XOR of all subsets then I noticed that frequency of each distinct XOR is the same. Exam

Direct way of computing clockwise angle between 2 vectors

I want to find out the clockwise angle between 2 vectors(2D, 3D). The clasic way with the dot product gives me the inner angle(0-180 degrees) and I need to us

Rotate a 3D- Point around another one

I have a function in my program which rotates a point (x_p, y_p, z_p) around another point (x_m, y_m, z_m) by the angles w_nx and w_ny. The new coordinates are

Get current quarter in year with javascript

How can I get the current quarter we are in with javascript? I am trying to detect what quarter we are currently in, e.g. 2. EDIT And how can I count the numbe

How to find a point where a line intersects an ellipse in 2D (C#)

I need to find a point where a line (its origin is ellipse' center) intersects an ellipse in 2D... I can easily find a point on a circle, because I know an angl

What is the proper way of calculating this flow calculation in Objective C?

I'm attempting to make a iPhone flow rate calculator that uses these 3 formulas. Pressure ratio b b = p2 + 0.1 / p1 + 0.1 The C-value and B-Value are given

Integer division in Python

I'm confused about the following integer math in python: -7/3 = -3 since (-3)*3 = -9 < -7. I understand. 7/-3 = -3 I don't get how this is defined. (-3)*(-