All Questions
238 questions
5
votes
1
answer
121
views
backward induction algorithm computation
Is there a way to significantly speed-up this code?
I'm solving a dynamic programming model using a backward induction algorithm. A crucial step is to calculate the current-period value function (VF), ...
-2
votes
1
answer
84
views
Intersect two arrays in python
I have two unidimensional numpy arrays in python, gs and ni. I want to intersect them but preserving the order in gs.
When they have high cardinality this operation becomes so costly. Is there any ...
2
votes
2
answers
260
views
Infinite 2d block world (2d minecraft) with chunk system, physics and slower loading
Follow up from this question. I have added a slower loading system that allows the main game to run faster but I still get under 30 fps with caves even if I allow the player to outrun the loading. I ...
3
votes
5
answers
2k
views
How do I speed up this simulation program
This is a program to solve a differential equation numerically using Euler method. As of now, it is very slow, and I need to run 10000 Monte Carlo simulations.
The differential equation is called ...
3
votes
1
answer
107
views
3ph 2l inverter simulation with SPWM
Here is a code for a simple model of three phase two level inverter with constant DC voltage source and three phase RL load.
...
4
votes
2
answers
177
views
NumPy script to convert BGR to HSL and back
This is a NumPy script that converts BGR arrays to HSL arrays and back, without using OpenCV. Input and output values are arrays of 3 dimensions with values ranging from 0 to 1, the shape of the ...
5
votes
1
answer
92
views
Generating Abelian sandpile "zeros" in python
Here is some code that generates the zero element of an Abelian sandpile model (ASM), for any given model dimensions, and then plots the result as a colormesh. Here is a wiki page explaining the ASM. ...
0
votes
1
answer
233
views
Find the first value bigger than a threshold
This function takes two inputs: A is 2D (N,5) while B is 1D (N).
It tries to find the smallest ...
2
votes
1
answer
189
views
Is this the right implementation for Linear Programming (puLP) on python?
I have created a LP function to help maximize a set of features. My first time playing with this library and also conducting LP.
Variables:
Number of features => X
Number of Categories => Y
...
6
votes
1
answer
153
views
basic Hartee-Fock program to compute the total energies and some properties of a molecule
I am trying to write a basic Hartee-Fock program that computes the total energies and some properties of a molecule given as an input. The code uses Cython to statically compile the computationally ...
6
votes
2
answers
512
views
Means square displacement (MSD)
I have written a code to calculate the MSD of some molecules. The code averages over multiple time origins (sliding time window) and over all the molecules. I have also made it do one extra thing: do ...
8
votes
2
answers
530
views
Fourier Series of a given function
This is a very simple code that expresses a function in terms of Trigonometric Fourier Series and generates a animation based on the harmonics. I would like to know some ways to improve the ...
3
votes
1
answer
165
views
Solve an option pricing PDE in Python - Part 1 [closed]
The Github repository NM-Heston solves call option prices under the Heston 2-factor model using ADI splitting schemes. I am adapting the code to price options under the 3-factor Heston-Hull-White ...
3
votes
0
answers
111
views
E-car-sharing problem with charging between the bookings
I am writing code that, at some later point, will be part of an academic multi-agent simulation of the learning process of car-sharing users and grid stability. This code deals with finding the price ...
2
votes
1
answer
151
views
Further optimizing the ISING model
I've implemented the 2D ISING model in Python, using NumPy and Numba's JIT:
...