Kronecker products can be used to efficiently and easily create 2D and 3D finite difference (and other) operators based on simple 1D operators for derivatives. Here’s a Jupyter notebook that shows you how to do this. You can find this notebook on nbviewer here.
Here’s a neat trick I learned today to display all matplotlib plots as vector format rather than raster in Jupyter notebooks:
This issue appears to have showed up on Sierra. Here’s a simple fix: Edit your bash profile (emacs ~/.bash_profile) Add export BROWSER=open Close your shell or source it (source ~/.bash_profile) Things should get back to normal now. Ref: https://github.com/conda/conda/issues/5408
make sure you don’t fall into the trap of copying pointers in Python: import numpy as np a = np.zeros(2) print(“a = “, a) b = np.zeros(2) print(“b = “, b) b = a # this assignment is simply a pointer copy – b points to the same data pointed to by a a=33.33 # …
First install a utility called highlight. It is available through macports and homebrew. sudo port install highlight Now that highlight is installed, you can “apply” it to a file and pipe it to the clipboard: highlight -O rtf MyCode.cpp | pbcopy Now go to Kenote and simply paste from clipboard (or command + v). Highlight …
Here are three ways to call a C++ classes’ operator () using a pointer: Say you have a C++ class name MyClass that overloads the operator “()”, something along the lines: I use method 2.
mkdir frames ffmpeg -i input -vf scale=320:-1:flags=lanczos,fps=10 frames/ffout%03d.png convert -loop 0 frames/ffout*.png -fuzz 20% -layers OptimizePlus output.gif Thanks to: http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
This code illustrates how to convert an analytical solution from polar coordinates to cartesian coordinates and subsequently be used to initialize a fluent simulation. This only works for 2d simulations.
Standalone C code that solves the two-dimensional heat equation. Contains a bunch of useful functions for creating 2D arrays in C using pointers.