Questions tagged [numpy]
NumPy is the fundamental package for scientific computing with the programming language Python.
51 questions
18
votes
1
answer
7k
views
Plot timings for a range of inputs
When writing Code Review answers, it becomes often necessary to measure how long the modified code takes vs how long the OP's code takes. I needed a nice way to visualize this as a function of the ...
11
votes
1
answer
14k
views
K-Mean with Numpy
I have implemented the K-Mean clustering Algorithm in Numpy:
...
15
votes
1
answer
1k
views
Racetrack plotter
My Racetrack is just that. A Racetrack. You can't race it (yet) because I had trouble with collision detection, but I wanted to share it anyway.
It creates a base polygon by using ...
14
votes
1
answer
10k
views
Faster computation of barycentric coordinates for many points
I'm just starting to understand the Python syntax and I created a module that does what I wanted, but really slow.
Here are the stats of cProfile, top 10 ordered by ...
11
votes
1
answer
6k
views
Game of Life with NumPy
I started this exercise with NumPy with a goal to find neighbors and return the new matrix. I want to get your feedback. Here's an example from this website. It looks like it's \$O(N^2)\$, and I'm ...
6
votes
2
answers
6k
views
Python / Numpy running 15x slower than MATLAB - am I using Numpy effeciently?
Here is some code I wrote in Python / Numpy that I pretty much directly translated from MATLAB code. When I run the code in MATLAB on my machine, it takes roughly 17 seconds. When I run the code in ...
4
votes
1
answer
122
views
Back to Basics - Tic Tac Toe
I've seen a few TTT related posts recently, and thought I might learn something or be reminded of certain techniques from attempting my own rendition. Here is that attempt! Hopefully any new coders ...
2
votes
0
answers
83
views
GUI Tic-Tac-Toe game with six AI players - part 2: the styling
This question is part of a series of posts about my massive Tic Tac Toe game with AI players, the previous question is: GUI Tic-Tac-Toe game with six AI players - part 1: the UI. This question ...
-1
votes
1
answer
137
views
52
votes
3
answers
172k
views
Finding the closest point to a list of points
I'm trying to find the closest point (Euclidean distance) from a user-inputted point to a list of 50,000 points that I have. Note that the list of points changes all the time. and the closest distance ...
17
votes
1
answer
616
views
Warhammer: How many of my attacks will succeed?
Me and a couple of mates sometimes play a game called Warhammer.
When playing the game you have options of what each model attacks.
This can lead to situations where you know if you shoot with 100% of ...
14
votes
2
answers
18k
views
Generating a 3D Point Cloud
I'm trying to produce a 3D point cloud from a depth image and some camera intrinsics. The image is 640x480, and is a NumPy array of bytes. The output is a (rows * columns) x 3 array of points.
I've ...
13
votes
1
answer
370
views
Population dynamic simulation on biological information maintenance 2
This question is the follow-up to this previous question.
Background
Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
13
votes
1
answer
1k
views
A big "Game of Life"
Our quest: Create a big simulation for Conway's Game of Life, and record the entire simulation history.
Current Approach: Cython is used for an iterate method. The ...
13
votes
3
answers
1k
views
Looking for the particles that are emitted when a fish is detected in Terraria
The code run perfectly fine, with no errors. However, the entirety of the code is in 1 function and is kind of hard to read. As well as that I'm not sure if and how the code could be more optimised/...