This is an example for the csquare gem which includes rational, complex, and Ruby object types.
A derivative form will be included in NMatrix v0.0.2 for matrix operations.
gem install csquare
Then, in IRB, simply:
The output will be in test.c.
BSD 2-clause. Copyright John Woods (mohawkjohn on github), 2012.