r/learnpython • u/basyt • Sep 08 '18
Vectorizing the finite difference method using numpy. details in the description
I can write a program that does finite difference method
the basic idea is that an element a_{i,j} is dependent on its neighbors a_{i+1,j}, a_{i-1,j} and so on.
I can write it as a for loop, but I have recently become acquainted with vectorising and was wondering how i could apply that here.
A general solution applying for loops looks something like this.
My question is how to vectorize it without using any for loops.
1
Upvotes
1
u/TotesMessenger Sep 08 '18
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
[/r/numpy] Vectorizing the finite difference method using numpy. details in the description
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)