We introduce CasADi; a minimalistic computer algebra system written in completely self-contained C++. The aim of the tool is to offer the benifits of a computer algebra to developers of C++ code; without the overhead usually associated with such systems. In particular; we use the tool to implement automatic differentiation; AD.
For maximum efficiency; CasADi works with two different graph representations interchangeably: One supporting only scalar-valued; built-in unary and binary operations and no branching; similar to the representation used by todayâ€™s tools for automatic differentiation by operator overloading. Secondly; a representation supporting matrixvalued operations; branchings such as if-statements as well as function calls to arbitrary functions (e.g. ODE/DAE integrators).
We show that the tool performs favorably compared to CppAD and ADOL-C; two state-of-the-art tools for AD by operator overloading. We also show how the tool can be used to solve a simple optimal control problem; minimal fuel rocket flight; by implementing a simple ODE integrator with sensitivity capabilities and solving the problem with the NLP solver IPOPT. In the last example; we show how we can use the tool to couple the modelling tool Jmodelica with the optimal control software ACADO Toolkit.
Keywords: computer algebra system; automatic differentiation; algorithmic differentiation; dynamic optimization; Modelica
3rd International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools; Oslo; Norway; October 3
 Johan Ă…kesson; TorbjĂ¶rn Ekman; and GĂ¶rel Hedin. Implementation of a modelica compiler using jastadd attributegrammars. Science of Computer Programming; 75(1-2):21 â€“ 38; 2010. Special Issue on ETAPS 2006 and 2007 Workshops on Language Descriptions; Tools; and Applications (LDTA â€™06 and â€™07).
 Andrei Alexandrescu. Modern C++ Design. Addison- Wesley; 2008.
 Andreas Griewank and David Juedes and Jean Utke. Algorithm 755: ADOL-C: a package for the automatic differentiation of algorithms written in C/C++. ACM Trans. Math. Softw.; 22(2):131â€“167; 1996.
 Lorenz T. Biegler. An overview of simultaneous strategies for dynamic optimization. Chemical Engineering and Processing: Process Intensification; 46(11):1043â€“1053; 2007. Special Issue on Process Optimization and Control in Chemical Engineering and Processing.
 Christian H. Bischof and Paul D. Hovland and Boyana Norris. Implementation of automatic differentiation tools (invited talk). j-SIGPLAN; 37(3):98â€“107; March 2002. Proceedings of the 2002 ACM SIGPLAN Workshop Partial Evaluation and Semantics-Based Program Manipulation (PEPMâ€™02).
 Thomas H. Cormen; Charles E. Leiserson; Ronald L. Rivest; and Clifford Stein. Introduction to Algorithms. MIT Press and McGraw-Hill; 2001.
 M. Grant and S. Boyd. Graph implementations for nonsmooth convex programs. In V. Blondel; S. Boyd; and H. Kimura; editors; Recent Advances in Learning and Control; Lecture Notes in Control and Information Sciences; pages 95â€“110. Springer-Verlag Limited; 2008.
 M. Grant and S. Boyd. CVX: Matlab software for disciplined convex programming; version 1.21. http: //cvxr.com/cvx; May 2010.
 Andreas Griewank and Andrea Walther. Evaluating Derivatives. SIAM; 2008.
 A. C. Hindmarsh; P. N. Brown; K. E. Grant; S. L. Lee; R. Serban; D. E. Shumaker; and C. S. Woodward. Sundials: Suite of nonlinear and differential/algebraic equation solvers. ACM Transactions on Mathematical Software; 2005.
 Boris Houska; Hans Joachim Ferreau; and Moritz Diehl. Acado toolkit - an open-source framework for automatic control and dynamic optimization. Optimal Control Methods and Application; 2010.
 Jan Albersmeyer and Moritz Diehl. The Lifted Newton Method and Its Application in Optimization. SIAM J. Optim; 20(3):1655â€“1684; 2010.
 Monagan; Michael B. and Neuenschwander; Walter M. GRADIENT: algorithmic differentiation inMaple. In ISSAC â€™93: Proceedings of the 1993 international symposium on Symbolic and algebraic computation; pages 68â€“76; New York; NY; USA; 1993. ACM.
 Jorge Nocedal and Stephen J. Wright. Numerical Optimization. Springer; August 2000.
 Lee Thomason; Yves Berquin; and Andrew Ellerton. Tinyxml; version 2.6.0. http://www.grinninglizard. com/tinyxml/; May 2010.
 A. WĂ¤chter and L. T. Biegler. On the implementation of an interior-point filter line-search algorithm for largescale nonlinear programming. Mathematical Programming; 106(1):25â€“57; 2006.