Project Description
A stand-alone program that can take MathML (acquired, e.g., from Microsoft Word 2007) and convert it to a meaningful set of C# statements, thereby facilitating domain-driven design in engineering and mathematical applications.
To see the program in action, watch the screencast.
System Requirements
Requires .NET Framework 3.5 to run and Visual Studio 2008 + NUnit to compile. To use the functionality, a MathML-compatible editor is required. If using MS Word, make sure your Clipboard settings for equations are set to copy MathML.
Features
Current version implements the following features:
- Variable naming (e.g., if we write x = y, both variables are defined as double x, y;).
- Multiplication sign addition (e.g., writing x = 2y results in the statement x = 2 * y;).
- Superscript and subscript. Superscript is taken to mean 'power of' and is realized with Math.Pow(). Subscript properly affects variable naming.
- Round and square braces are handled.
- Some replacements, e.g. replaces × with *.
- Substitutions, e.g., replacing 'e' with Math.E, are supported.
- Power inlining. Allows us to generate x*x instead Math.Pow(x, 2), which is much slower.
An Example
Given this:
The tool outputs this:
p = rho*R*T + (B_0*R*T-A_0-((C_0) / (T*T))+((E_0) / (Math.Pow(T, 4))))*rho*rho +
(b*R*T-a-((d) / (T)))*Math.Pow(rho, 3) +
alpha*(a+((d) / (t)))*Math.Pow(rho, 6) +
((c*Math.Pow(rho, 3)) / (T*T))*(1+gamma*rho*rho)*Math.Exp(-gamma*rho*rho);