Skip to main content

Questions tagged [numpy]

NumPy is the fundamental package for scientific computing with the programming language Python.

Filter by
Sorted by
Tagged with
4 votes
1 answer
365 views

Context & Background Please let me remind you that this project may involve original research; it is important to remember that all content on this site is subject to CC BY-SA 4.0. It is a breach ...
Konchog's user avatar
  • 355
4 votes
3 answers
387 views

Recently I have been using numpy arrays, which have great utility via their broadcasting methods. I am attempting to write a useful public facing library, and this ...
Konchog's user avatar
  • 355
6 votes
1 answer
458 views

I've written a Python script to solve a system of coupled differential equations and then use the results to solve an eigenvalue problem. The full problem is: \$\frac{d^2}{dr^2} K(r) = \frac{K(r)}{r^2}...
Amirhossein Rezaei's user avatar
2 votes
1 answer
87 views

I'm solving a linear programming problem, made of many small problems with some common shared constraints, meaning that they are all together. Each individual unit has constraints unique to the unit ...
AReubens's user avatar
4 votes
1 answer
214 views

I'm trying to build a function that identifies those who are promoted into a list of jobcodes, or are promoted within that list of jobcodes. Initially I was using ...
Gage's user avatar
  • 41
6 votes
2 answers
747 views

I have a piece of code to calculate price sensitivity based on the product and its rating. Below is the original data set with product type, reported year, customer’s rating, price per unit, and ...
Laura's user avatar
  • 81
5 votes
2 answers
319 views

I was trying to rewrite the Python code in MATLAB. The result is consistent. But, the MATLAB code is so slow. Any help would be appreciated. Ref python code link The MATLAB code written by me is as ...
138 Aspen's user avatar
  • 469
3 votes
5 answers
2k views

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 ...
Jonathan Wick's user avatar
10 votes
3 answers
1k views

I have the following function that returns one of several functions along with their derivative for training neural networks. Can this function be improved and made more pythonic in any way? Are there ...
Atharva's user avatar
  • 185
-1 votes
1 answer
63 views

I use the following code for a manual single value decomposition using numpy. Depending on the array I choose it sometimes works out well and I can verify the svd and sometimes it does not work out ...
LF-137's user avatar
  • 7
14 votes
1 answer
1k views

Good evening. I am studying mathematics at the moment, so I have little to no formal education in actual computer engineering. However, I am trying my hands at learning Python because I will need lots ...
francescoriccardocrescenzi's user avatar
3 votes
1 answer
118 views

Here is a code for a simple model of three phase two level inverter with constant DC voltage source and three phase RL load. ...
ppinha's user avatar
  • 51
0 votes
2 answers
161 views

I wrote this code to indicate duplicated values. It actually works but I hope to know if there's another possible solution to optimize this process. Thanks. ...
peternish's user avatar
5 votes
1 answer
102 views

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. ...
Eden Laika's user avatar
5 votes
3 answers
318 views

I'm thinking I implemented it optimally, but somehow it's much slower than what should be much slower, np.argmax(np.abs(x)). Where am I off? Code rationale & ...
OverLordGoldDragon's user avatar
4 votes
3 answers
165 views

I have a list with some nan values, out of which some are continuous, e.g.: list = [1, 2, 3, np.nan, np.nan, 6, 7, np.nan, 9, np.nan,np.nan,np.nan, 12] For some ...
Ranjan Kumar Sahu's user avatar
3 votes
0 answers
182 views

Related This is a Python script that generates images using prime numbers up to a given positive integer, it generates prime numbers using the Sieve of Eratosthenes with some rudimentary Wheel ...
Ξένη Γήινος's user avatar
6 votes
2 answers
555 views

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 ...
mjksho's user avatar
  • 61
2 votes
1 answer
103 views

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 ...
Leon0402's user avatar
  • 151
1 vote
1 answer
92 views

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 ...
Jessie's user avatar
  • 113
3 votes
1 answer
190 views

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 ...
Ruan's user avatar
  • 111
2 votes
1 answer
165 views

I've implemented the 2D ISING model in Python, using NumPy and Numba's JIT: ...
Amirhossein Rezaei's user avatar
2 votes
2 answers
2k views

As you will probably notice very quickly from the code below, I'm not very experienced coder. Below is my attempt at valuating poker hands in Python. The code below may not be pretty but it seems to ...
Tom Mart's user avatar
9 votes
1 answer
4k views

...
ijknm's user avatar
  • 99

1
2 3 4 5
16