Exporting Pixel-Perfect Graphics in Mathematica
I keep having to figure out how to export pixel-perfect raster images from Mathematica, which I use for test images with my software. I found that it’s simpler to use ArrayPlot than Raster now, so I’m...
View ArticlePixel-perfect Graphics, Revisited
Mathematica 7 introduces a new Image function that eliminates all the hassle previously necessary to create and export pixel-perfect raster images. Instead of using ArrayPlot to generate the image, I...
View ArticleAdding a keyboard shortcut to Mathematica V7
(updated 2009-03-23 to add the backslashes that disappeared between my blog editor and WordPress) In Mathematica, typing index brackets is clumsy, as one has to type esc-[[-esc then esc-]]-esc. I found...
View ArticleConverting symbolic Mathematica expressions to C code
I frequently use Mathematica to rearrange or solve symbolic equations to use in C++ programs. While Mathematica is quite powerful for that, it has no facility to hoist common subexpressions into...
View ArticleDefining new format wrappers in Mathematica
One problem I had with the expression-to-C converter is that CForm converts negations of terms into a negation of parenthesized terms. For example: In[1]:= -a b // CForm Out[1]//CForm= -(a*b) That...
View Article2D Matrix Decomposition
This demonstrates the polar decomposition of 2D matrices into their angle, scale, and shear components. The polarDecomp algorithm is taken from Shoemake & Duff “Matrix Animation and Polar...
View Article