All Questions
20
questions
4
votes
1
answer
63
views
Array Math to Calculate Ice Thickness -- Need Help Simplifying
I posted this on Stack but since it's working code, it was suggested I post it here. I wrote this code to calculate ice thickness using the following equation from Stephenson, 2011.
It's a daily ...
2
votes
0
answers
82
views
Python script that generates images using Thue-Morse sequence
In mathematics, the Thue–Morse sequence, or Prouhet–Thue–Morse sequence, is the binary sequence (an infinite sequence of 0s and 1s) obtained by starting with 0 and successively appending the Boolean ...
2
votes
1
answer
82
views
Readable Backprogragation calculations in Numpy Neural Network
As an exercise we should write a small Neural Network with the following structure:
There should be additionally a bias for each layer and sigmoid should be used as the activation function.
The ...
1
vote
1
answer
66
views
Fixing math library functions in Black-Scholes options pricing model
I've amended a code for the Black-Scholes formula for European pricing options found here at the bottom of the page and fixed the math functions accordingly. Unlike the code on the website, mine has ...
2
votes
2
answers
1k
views
Solving the TDoA multilateration problem in 3-dimensions
Background.
I've written an algorithm to solve the Time Difference of Arrival (TDoA) multilateration problem in 3-dimensions. That is, given the known coordinates of ...
2
votes
2
answers
775
views
Finding distance between vectors of matrices
So here is the problem:
Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m
respectively and one natural number 'p'. You need to find the
distance(Euclidean) of the rows of the matrices 'a' and ...
5
votes
1
answer
433
views
Bancroft's method implementation
Background
I've written an algorithm to solve the three-dimensional Time Difference of Arrival (TDoA) multi-lateration problem. That is, given the coordinates of n ...
4
votes
1
answer
312
views
Simulated annealing for magic square-of-squares puzzle
I'm working on a function that takes in a NumPy array containing only mutually distinct positive square numbers. I want the function to pick an element at random, find if there is a lower positive ...
4
votes
1
answer
533
views
Drawing spirals on virtual whiteboards
I have it set up so I place my mouse in the center of where I want the spiral to be, then I press enter to start the program, then define the radius initially and how much it grows each time it goes ...
4
votes
2
answers
650
views
Python numerical integration
Could the time complexity of this definite integral algorithm be improved?
...
2
votes
1
answer
162
views
Calculate the sum over a list of minima of two vectors
I have the following metric:
def d(x, y):
"""The metric."""
return 1 - sum(min(xi, yi) for xi, yi in zip(x, y))
where ...
1
vote
0
answers
1k
views
Snell's law using Zoeppritz equation by matrices
I have created the following code to calculate Snell's law angles, based on Zoeppritz equations on complex plane. The code works, seems it is returning valid values, but after all the code just looks ...
13
votes
2
answers
1k
views
Numerics for a game theory calculation using expected utility
I am trying to replicate Bruce B. de Mesquita's (BDM) results on political game theory for prediction. Based on where actors stand on issues, their capabilities, salience, BDM's method attempts to ...
1
vote
1
answer
165
views
Vectorizing in Python [closed]
I have the following code:
...
7
votes
1
answer
125
views
Weighted phase Laplacian formula
We have the following equation (weighted phase Laplacian):
\$c_{i,j} = U(i,j)\Delta^{^x}_{i,j} - U(i-l, j)\Delta^{x}_{i-1,j} + V(i,j)\Delta^{y}_{i,j} - V(i,j-1)\Delta^{y}_{i,j-1}\$
Where
\$U(i,j) = ...