<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Steve Heberts dotMath Library</title><link>http://dotmath.codeplex.com/project/feeds/rss</link><description>The dotMath library is a two-pass expression compiler written entirely in C&amp;#35; for the Microsoft .NET platform. The library requires only the core .NET library dependency and does not require any file access privilages for execution - compilation and execution occurs entirely in-memory.</description><item><title>Source code checked in, #99885</title><link>http://dotmath.codeplex.com/SourceControl/changeset/changes/99885</link><description>Upgrade&amp;#58; New Version of LabDefaultTemplate.xaml. To upgrade your build definitions, please visit the following link&amp;#58; http&amp;#58;&amp;#47;&amp;#47;go.microsoft.com&amp;#47;fwlink&amp;#47;&amp;#63;LinkId&amp;#61;254563</description><author>Project Collection Service Accounts</author><pubDate>Mon, 01 Oct 2012 21:24:31 GMT</pubDate><guid isPermaLink="false">Source code checked in, #99885 20121001092431P</guid></item><item><title>Source code checked in, #99884</title><link>http://dotmath.codeplex.com/SourceControl/changeset/changes/99884</link><description>Checked in by server upgrade</description><author>Project Collection Service Accounts</author><pubDate>Mon, 01 Oct 2012 21:16:08 GMT</pubDate><guid isPermaLink="false">Source code checked in, #99884 20121001091608P</guid></item><item><title>Commented Issue: Complex calculation [25995]</title><link>http://dotmath.codeplex.com/workitem/25995</link><description>if&amp;#40;4&amp;#62;5,10,100&amp;#41; &amp;#42; 5 &amp;#61;&amp;#61;&amp;#61;&amp;#61;&amp;#62; 500 but not calculated correctly.&lt;br /&gt;Comments: ** Comment from web user: fernandezajp ** &lt;p&gt;replace SetFunction&amp;#40; sEquation &amp;#41;&amp;#59;    by     SetFunction&amp;#40; &amp;#34;&amp;#40;&amp;#34;&amp;#43;sEquation&amp;#43;&amp;#34;&amp;#41;&amp;#34; &amp;#41;&amp;#59;&lt;br /&gt;in EqCompiler constructor&lt;/p&gt;</description><author>fernandezajp</author><pubDate>Wed, 20 Apr 2011 14:39:01 GMT</pubDate><guid isPermaLink="false">Commented Issue: Complex calculation [25995] 20110420023901P</guid></item><item><title>Source code checked in, #74794</title><link>http://dotmath.codeplex.com/SourceControl/changeset/changes/74794</link><description>Checked in by server upgrade</description><author>_TFSSERVICE</author><pubDate>Tue, 03 Aug 2010 19:44:57 GMT</pubDate><guid isPermaLink="false">Source code checked in, #74794 20100803074457P</guid></item><item><title>Created Issue: Complex calculation [25995]</title><link>http://dotmath.codeplex.com/WorkItem/View.aspx?WorkItemId=25995</link><description>if&amp;#40;4&amp;#62;5,10,100&amp;#41; &amp;#42; 5 &amp;#61;&amp;#61;&amp;#61;&amp;#61;&amp;#62; 500 but not calculated correctly.&lt;br /&gt;</description><author>tunzey</author><pubDate>Wed, 20 Jan 2010 19:01:59 GMT</pubDate><guid isPermaLink="false">Created Issue: Complex calculation [25995] 20100120070159P</guid></item><item><title>Source code checked in, #34065</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Fleshed out tests for token and whitespace handling to obtain 100&amp;#37; code coverage</description><author>sdhebert</author><pubDate>Fri, 20 Jun 2008 16:02:23 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34065 20080620040223P</guid></item><item><title>Source code checked in, #34059</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Added Token.Equals override tests</description><author>sdhebert</author><pubDate>Thu, 19 Jun 2008 11:08:55 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34059 20080619110855A</guid></item><item><title>Source code checked in, #34058</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Added GetHashCode Tests</description><author>sdhebert</author><pubDate>Thu, 19 Jun 2008 11:00:50 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34058 20080619110050A</guid></item><item><title>Source code checked in, #34057</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Add Token constructor tests</description><author>sdhebert</author><pubDate>Thu, 19 Jun 2008 10:49:20 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34057 20080619104920A</guid></item><item><title>Source code checked in, #34056</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Added CharType enumeration</description><author>sdhebert</author><pubDate>Thu, 19 Jun 2008 10:29:37 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34056 20080619102937A</guid></item><item><title>Source code checked in, #34055</title><link>http://www.codeplex.com/dotMath/SourceControl/ListDownloadableCommits.aspx</link><description>Initial checkin with base tests</description><author>sdhebert</author><pubDate>Thu, 19 Jun 2008 03:12:09 GMT</pubDate><guid isPermaLink="false">Source code checked in, #34055 20080619031209A</guid></item><item><title>COMMENTED ISSUE: Boolean expressions</title><link>http://www.codeplex.com/dotMath/WorkItem/View.aspx?WorkItemId=12575</link><description>Hi, I had been testing this library, it&amp;#39;s awsome, but It looks like the boolean expressions have some problems an expression like &amp;#34;100&amp;#62;50 and 30&amp;#62;50&amp;#34; returns &amp;#34;1&amp;#34; instead of &amp;#34;0&amp;#34; &amp;#40;False&amp;#41;, and &amp;#34;30&amp;#62;50 and 100&amp;#62;50&amp;#34; returns &amp;#34;0&amp;#34;. I think that the Calculate&amp;#40;&amp;#41; methos is only evaluating the first part of the expression.&lt;br /&gt;&lt;br /&gt;Richo&lt;br /&gt;Comments: ** Comment from web user: exigeguy ** &lt;p&gt;I tried your test case and I was able to get it to work by wrapping either side of the and with parenthesis, e.g. &amp;#40;100 &amp;#62; 50&amp;#41; &amp;#38;&amp;#38; &amp;#40;30&amp;#62;50&amp;#41;.  I had to add the CAnd operator in the InitFunctions&amp;#40;&amp;#41; method.  The problem is it gets fouled up trying to evaluate complex logical expressions because it is trying to evaluate 50 &amp;#38;&amp;#38; 30&amp;#62;50 instead of maintaining the expression to the left of the &amp;#38;&amp;#38; operator.  I fixed it locally and also added support for string operations.&lt;/p&gt;</description><author>exigeguy</author><pubDate>Wed, 06 Feb 2008 20:12:46 GMT</pubDate><guid isPermaLink="false">COMMENTED ISSUE: Boolean expressions 20080206081246P</guid></item><item><title>CREATED ISSUE: Boolean expressions</title><link>http://www.codeplex.com/dotMath/WorkItem/View.aspx?WorkItemId=12575</link><description>Hi, I had been testing this library, it&amp;#39;s awsome, but It looks like the boolean expressions have some problems an expression like &amp;#34;100&amp;#62;50 and 30&amp;#62;50&amp;#34; returns &amp;#34;1&amp;#34; instead of &amp;#34;0&amp;#34; &amp;#40;False&amp;#41;, and &amp;#34;30&amp;#62;50 and 100&amp;#62;50&amp;#34; returns &amp;#34;0&amp;#34;. I think that the Calculate&amp;#40;&amp;#41; methos is only evaluating the first part of the expression.&lt;br /&gt;&lt;br /&gt;Richo&lt;br/&gt;</description><author>ralcorta</author><pubDate>Tue, 04 Sep 2007 17:14:47 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Boolean expressions 20070904051447P</guid></item><item><title>NEW POST: In Commercial Library...</title><link>http://www.codeplex.com/dotMath/Thread/View.aspx?ThreadId=11129</link><description>&lt;div class="wikidoc"&gt;
I am creating a commercial charting library for my company. Can I include this library for user-typed&lt;br /&gt;equation/function processing?&lt;br /&gt; &lt;br /&gt;Best regards,&lt;br /&gt;Paul.&lt;br /&gt;
&lt;/div&gt;</description><author>SelormeyPaul</author><pubDate>Thu, 07 Jun 2007 03:57:26 GMT</pubDate><guid isPermaLink="false">NEW POST: In Commercial Library... 20070607035726A</guid></item><item><title>New Post: In Commercial Library...</title><link>http://dotmath.codeplex.com/Thread/View.aspx?ThreadId=11129</link><description>&lt;div style="line-height: normal;"&gt;
I am creating a commercial charting library for my company. Can I include this library for user-typed&lt;br /&gt;equation/function processing?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Paul.&lt;br /&gt;&lt;/div&gt;</description><author>SelormeyPaul</author><pubDate>Thu, 07 Jun 2007 03:57:26 GMT</pubDate><guid isPermaLink="false">New Post: In Commercial Library... 20070607035726A</guid></item><item><title>UPDATED WIKI: The History of dotMath</title><link>http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=The History of dotMath&amp;version=5</link><description>&lt;p&gt;
&lt;h2&gt;A Brief History of dotMath&lt;/h2&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Initial Design&lt;/h3&gt;
The initial design of .Math came about in 1997 with a need to create a function evaluator in C++.&amp;nbsp;&amp;nbsp;After looking around for commercial libraries, the pieces available generally reached a complexity we weren’t requiring and too expensive.&amp;nbsp;&amp;nbsp;We had a need for fairly simple equations (such as 4&lt;b&gt;x^2 + 2&lt;/b&gt;x +24) where we would perform a wide range of values for x and evaluate each one.&amp;nbsp;&amp;nbsp;I went back to my college compiler books, read up on the subject and decided I could handle the problem myself.&amp;nbsp;&amp;nbsp;I decided to expose the variables thorough an interface and allow them to be discovered and set.&amp;nbsp;&amp;nbsp;At this point the code supported a minimal set of trig-functions.&amp;nbsp;&amp;nbsp;This implementation ran approximately 75,000 calculations per second on a Pentium 2 450.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Creating the Compiler&lt;/h3&gt;
I used similar implementations on other projects and contemplated createing a ‘true’ compiler.&amp;nbsp;&amp;nbsp;The speed increase would be significant, but never significant enough to warrant the time spent.&amp;nbsp;&amp;nbsp;Then, in 2000, I decided to go ahead tackle the problem. It became apparent I could make this into a nice O-O based structure with the implementation classes compiled in C++ and instantiated as-needed.&amp;nbsp;&amp;nbsp;This structure gave me the opportunity to make the compiler extensible by registering new functions with the framework. Given the O-O framework, the first two-passes are handled by the code, while the linking was handled during the application compile. It’s a different way of looking at the compilation problem, but much simpler in terms of building and delivering the solution.&amp;nbsp;&amp;nbsp;I took this implementation and ported it to an early Visual Basic.NET implementation to test how the new language O-O features behaved.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Multi-Parameter Functions and Binary Operators&lt;/h3&gt;
Shortly after creating the compiler, the need for more complex functions arose.&amp;nbsp;&amp;nbsp;These functions were modeled after the Excel format with comma-separators.&amp;nbsp;&amp;nbsp;I quickly realized that each function within the statement could be handled as a separate compiled function that shared the same variable space with the rest of the equation.&amp;nbsp;&amp;nbsp;At that point, the implementation became very simple.&amp;nbsp;&amp;nbsp;The most intriguing function then became the If-statement as such:&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
if&amp;#40; condition, then-result, else-result &amp;#41;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
The if-statement required the use of binary operators (&amp;lt;, &amp;gt;, &amp;lt;=, &amp;lt;&amp;gt;, etc).&amp;nbsp;&amp;nbsp;The binary operation returns a 1 for true or a 0 for false.&amp;nbsp;&amp;nbsp;The if statement only tests for 0 equality – perform else portion if 0, otherwise perform then portion.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Porting to C# and the .NET Platform&lt;/h3&gt;
I ported the code to C# in 2003 out of interest in reviving the code.&amp;nbsp;&amp;nbsp;I later used the project in 2004 to provide dimensionality support to a planning application.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Looking Ahead&lt;/h3&gt;
There are a number of directions the code can take, including code optimization and levelization of the called objects.&amp;nbsp;&amp;nbsp;Levelization offers the biggest payback because the current implementation relies heavily on the call-stack.&amp;nbsp;&amp;nbsp;Getting away from the call-stack will remove the reliance on the memory allocations and jumps that become significant when doing millions of operations. I believe levelization of the function calls would involve using an accumulator structure for storing operation values one at a time.&lt;br/&gt;
&lt;br/&gt;
&lt;/p&gt;
</description><author>sdhebert</author><pubDate>Thu, 26 Oct 2006 01:50:06 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: The History of dotMath 20061026015006A</guid></item><item><title>UPDATED WIKI: Built-in functions and operators</title><link>http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Built-in functions and operators&amp;version=3</link><description>&lt;p&gt;
&lt;h2&gt;Built-in Operators and Functions&lt;/h2&gt;
&lt;/p&gt;
&lt;p&gt;
The following lists show the built-in functions and operators that are included in dotMath.&amp;nbsp;&amp;nbsp;You can add your own functions by creating classes and registering with dotMath before compiling.&amp;nbsp;&amp;nbsp;Check out &lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Getting%20Started%20-%20How%20to%20use%20dotMath"&gt;Getting Started - How to use dotMath&lt;/a&gt; to learn more.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Binary Operators &lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;table border="1" cellspacing="0" cellpadding="3" &gt;&lt;tr&gt;&lt;th&gt;Operator&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;=&lt;/td&gt;&lt;td&gt;Returns 1 if both sides are equal.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;lt;&lt;/td&gt;&lt;td&gt;Returns 1 if left side is less than the right.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;gt;&lt;/td&gt;&lt;td&gt;Returns 1 if left side is greater than the right.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;lt;=&lt;/td&gt;&lt;td&gt;Returns 1 if the left side is less than or equal to the right.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;gt;=&lt;/td&gt;&lt;td&gt;Returns 1 if the left side is greater than or equal to the right.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;lt;&amp;gt;&lt;/td&gt;&lt;td&gt;Returns 1 if the left side is not equal to the right.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&amp;amp;&lt;/td&gt;&lt;td&gt;Returns 1 if both sides are not equal to 0&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Returns 1 if one or both sides are not equal to 1.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Built-in Functions&lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;table border="1" cellspacing="0" cellpadding="3" &gt;&lt;tr&gt;&lt;th&gt;Function&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Abs&lt;/td&gt;&lt;td&gt;Absolute value of a specified value or expression.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Acos&lt;/td&gt;&lt;td&gt;Returns the angle whose cosine is the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Asin&lt;/td&gt;&lt;td&gt;Returns the angle whose sin is the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Atan&lt;/td&gt;&lt;td&gt;Returns the angle whose tangent is the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Ceiling&lt;/td&gt;&lt;td&gt;Returns the smallest whole number greater than or equal to the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Cos&lt;/td&gt;&lt;td&gt;Returns the cosine of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Cosh&lt;/td&gt;&lt;td&gt;Returns the hyperbolic cosine of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Exp&lt;/td&gt;&lt;td&gt;Returns e raised to the specified power.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Floor&lt;/td&gt;&lt;td&gt;Returns the largest whole number less than or equal to the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Log&lt;/td&gt;&lt;td&gt;Returns the logarithm of the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Log10&lt;/td&gt;&lt;td&gt;Returns the base 10 logarithm of the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Round&lt;/td&gt;&lt;td&gt;Returns the value nearest the specified value.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sign&lt;/td&gt;&lt;td&gt;Returns a value indicating the sign of the specified value.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sin&lt;/td&gt;&lt;td&gt;Returns the sine of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sinh&lt;/td&gt;&lt;td&gt;Returns the hyperbolic sine of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sqrt&lt;/td&gt;&lt;td&gt;Returns the square root of the specified number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Tan&lt;/td&gt;&lt;td&gt;Returns the tangent of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Tanh&lt;/td&gt;&lt;td&gt;Returns the hyperbolic tangent of the specified angle.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Min&lt;/td&gt;&lt;td&gt;Min(expr1, expr2, &lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=%u2026%2c%20expr%28n%29"&gt;…, expr(n)&lt;/a&gt;)&amp;nbsp;&amp;nbsp;Min returns the minimum value among the list of evaluated expressions.&amp;nbsp;&amp;nbsp;The list may contain 2 or more elements.&amp;nbsp;&amp;nbsp;Highest current test uses 50,000 values in the expression list.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Max&lt;/td&gt;&lt;td&gt;Max(expr1, expr2, &lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=%u2026%2c%20expr%28n%29"&gt;…, expr(n)&lt;/a&gt;)&amp;nbsp;&amp;nbsp;Max returns the maximum value among the list of evaluated expressions.&amp;nbsp;&amp;nbsp;The list may contain 2 or more elements.&amp;nbsp;&amp;nbsp;Highest current test uses 50,000 values in the expression list.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;If&lt;/td&gt;&lt;td&gt;If( binary&lt;i&gt;expression, true&lt;/i&gt;expression, false&lt;i&gt;expression )&amp;nbsp;&amp;nbsp;If the value of binary&lt;/i&gt;expression is non-zero, the true&lt;i&gt;expression evaluation is returned. Otherwies the false&lt;/i&gt;expression is returned.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/p&gt;
&lt;p&gt;
&lt;br/&gt;
&lt;/p&gt;
</description><author>sdhebert</author><pubDate>Thu, 26 Oct 2006 01:49:55 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Built-in functions and operators 20061026014955A</guid></item><item><title>UPDATED WIKI: Getting Started - How to use dotMath</title><link>http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Getting Started - How to use dotMath&amp;version=3</link><description>&lt;p&gt;
&lt;h2&gt;How to use dotMath&lt;/h2&gt;
&lt;/p&gt;
&lt;p&gt;
The following page is focused on understanding how to use dotMath in your application and get up and running in the shortest amount of time.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
If you are using the compiled assembly library, be sure to create a reference to the .Math library and include the library DLL in your distribution package.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Scenario 1:&amp;nbsp;&amp;nbsp;Evaluating an Expression&lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
In order to take an expression without variables stored in a string – sExpression – and evaluate its value we need the following set of code.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
sExpression &amp;#61; &amp;#8220;4&amp;#43;3&amp;#8221;&amp;#59;
EqCompiler oCompiler &amp;#61; new EqCompiler&amp;#40; sExpression, true&amp;#41;&amp;#59;
oCompiler.Compile&amp;#40;&amp;#41;&amp;#59;
double dValue &amp;#61; oCompiler.Calculate&amp;#40;&amp;#41;&amp;#59;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
If you do not perform the ‘.Compile()’ step, it will be executed automatically the first time you perform ‘.Calculate();’.&amp;nbsp;&amp;nbsp;Wherever the compile step is performed it is important to place a try..catch block around it to capture any compilation errors.&amp;nbsp;&amp;nbsp;All errors raised by the compilers are ApplicationExceptions.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Scenario 2: Evaluating an Expression with Variables&lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Taking advantage of expressions with variables involves discovering the variables and setting them before performing the .Calculate() step.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
sExpression &amp;#61; &amp;#8220;a&amp;#43;b&amp;#8221;&amp;#59;
EqCompiler oCompiler &amp;#61; new EqCompiler&amp;#40; sExpression, true&amp;#41;&amp;#59;
oCompiler.Compile&amp;#40;&amp;#41;&amp;#59;
string&amp;#91;&amp;#93; asVars &amp;#61; oCompiler.GetVariableList&amp;#40;&amp;#41;&amp;#59;
&amp;#47;&amp;#47; At this point we have the variable list and we can do what we want.
&amp;#47;&amp;#47; Here, we&amp;#8217;ll set the values of each variable using the interface&amp;#8230;
double dValue &amp;#61; 1.0&amp;#59;
foreach &amp;#40;string sVar in asVars&amp;#41;
&amp;#123;
       oCompiler.SetVariable&amp;#40; sVar, dValue &amp;#41;&amp;#59;
       dValue &amp;#61; dValue &amp;#43;1.5&amp;#59;    
&amp;#125;
&amp;#47;&amp;#47; at this point we&amp;#8217;re ready to calculate the expression with our declared variable values.
double dValue &amp;#61; oCompiler.Calculate&amp;#40;&amp;#41;&amp;#59;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h3&gt;Scenario 3:&amp;nbsp;&amp;nbsp;Adding user-defined functions to the compiler’s syntax.&lt;/h3&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
The .Math library allows the user to extend the syntax of functions by creating classes and registering them with the compiler. In this case, we’ll create a function called Pythag(a,b) where given the length of side a and the length of side b, we’ll return side c (assuming we’re dealing with a right triangle).&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
First, we’ll create our class:&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
using dotMath&amp;#59;
&amp;#47;&amp;#47;&amp;#47; &amp;#60;summary&amp;#62;
&amp;#47;&amp;#47;&amp;#47; CTanh class&amp;#58; Returns the hyperbolic tangent of the supplied angle.
&amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;summary&amp;#62;
public class CPythag &amp;#58; EqCompiler.CFunction 
&amp;#123;
         ArrayList m_alValues&amp;#59;
         public CPythag&amp;#40; &amp;#41;       
         &amp;#123;
         &amp;#125;
          &amp;#47;&amp;#47;&amp;#47; &amp;#60;summary&amp;#62;
         &amp;#47;&amp;#47;&amp;#47; CreateInstance&amp;#58; this function is used to create
         &amp;#47;&amp;#47;&amp;#47; and return an object for evaluation of Pythag&amp;#40;a,b&amp;#41;
         &amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;summary&amp;#62;
         public override EqCompiler.CFunction CreateInstance&amp;#40; ArrayList alValues &amp;#41; 
         &amp;#123;
                  CPythag oPythag &amp;#61; new CPythag&amp;#40;&amp;#41;&amp;#59;
                  oPythag.SetValue&amp;#40; alValues &amp;#41;&amp;#59;
                  return oPythag&amp;#59;
         &amp;#125;
          &amp;#47;&amp;#47;&amp;#47; &amp;#60;summary&amp;#62;
         &amp;#47;&amp;#47;&amp;#47; SetValue&amp;#40;ArrayList&amp;#41;&amp;#58; this function accepts an arraylist
         &amp;#47;&amp;#47;&amp;#47; of CValue objects that represent the parameters passed.
         &amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;summary&amp;#62;
         public override void SetValue&amp;#40; ArrayList alValues &amp;#41;
         &amp;#123;
                  &amp;#47;&amp;#47;&amp;#47; CheckParms is a CFunction member that validates
                  &amp;#47;&amp;#47; the number of parameters.  It throws an exception
                  &amp;#47;&amp;#47; formatted for the client if a mismatch occurs.
                  CheckParms&amp;#40;alValues,2&amp;#41;&amp;#59;
                  m_alValues &amp;#61; alValues&amp;#59;
         &amp;#125;
         &amp;#47;&amp;#47;&amp;#47; &amp;#60;summary&amp;#62;
         &amp;#47;&amp;#47;&amp;#47; GetValue&amp;#40;&amp;#41;&amp;#58; returns the evaluated function value during
         &amp;#47;&amp;#47;&amp;#47; the .Calculate process.
         &amp;#47;&amp;#47;&amp;#47; &amp;#60;&amp;#47;summary&amp;#62;
         public override double GetValue&amp;#40;&amp;#41;
         &amp;#123;
                  EqCompiler.CValue oValue1 &amp;#61; &amp;#40;EqCompiler.CValue&amp;#41; m_alValues&amp;#91;0&amp;#93;&amp;#59;
                  EqCompiler.CValue oValue2 &amp;#61; &amp;#40;EqCompiler.CValue&amp;#41; m_alValues&amp;#91;1&amp;#93;&amp;#59;
                  return Math.Sqrt&amp;#40;Math.Pow&amp;#40;oValue1.GetValue&amp;#40;&amp;#41;,2&amp;#41; &amp;#43; Math.Pow&amp;#40;oValue2.GetValue&amp;#40;&amp;#41;,2&amp;#41;&amp;#41;&amp;#59;       &amp;#125;
          public override string GetFunction&amp;#40;&amp;#41;
         &amp;#123;
                  return &amp;#34;pythag&amp;#34;&amp;#59;
         &amp;#125;
&amp;#125;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
When we’re ready to evaluate the function, the following code enables the function:&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
string sFunction &amp;#61; &amp;#8220;pythag&amp;#40;2,4&amp;#41;&amp;#8221;&amp;#59;
EqCompiler eq &amp;#61; new EqCompiler&amp;#40; txtFunction.Text.Trim&amp;#40;&amp;#41;,true&amp;#41;&amp;#59;
eq.AddFunction&amp;#40; new CPythag&amp;#40;&amp;#41; &amp;#41;&amp;#59;
&lt;/pre&gt;
&lt;br/&gt;
&lt;/p&gt;
</description><author>sdhebert</author><pubDate>Thu, 26 Oct 2006 01:49:43 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Getting Started - How to use dotMath 20061026014943A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Home&amp;version=22</link><description>&lt;p&gt;
&lt;h1&gt;Welcome to the &lt;i&gt;dotMath Library&lt;/i&gt;&lt;/h1&gt;
&lt;/p&gt;
&lt;p&gt;
Welcome to dotMath, the extensible OpenSource expression compiler for the .NET platform written entirely in C#.&amp;nbsp;&amp;nbsp;Offering speed through compilation of expressions, the library allows for variable handling, an entire function library and the ability to add your own functions.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
If you need to evaluate fixed or variable expressions, dotMath is your solution:&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;fixed expression example:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(sin(5)* cos(4/5)) / 3&lt;/i&gt;&lt;br/&gt;
&lt;i&gt;variable expressions example: (sin(a)* cos(b/a)) / c&lt;/i&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
Download the Version 1.0 release here... [release:875]&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Getting%20Started%20-%20How%20to%20use%20dotMath"&gt;Getting Started - How to use dotMath&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Built-in%20functions%20and%20operators"&gt;Built-in functions and operators&lt;/a&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=The%20History%20of%20dotMath"&gt;The History of dotMath&lt;/a&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br/&gt;
&lt;/p&gt;
</description><author>sdhebert</author><pubDate>Thu, 26 Oct 2006 01:49:24 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20061026014924A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Home&amp;version=21</link><description>&lt;p&gt;
&lt;h1&gt;Welcome to the &lt;i&gt;dotMath Library&lt;/i&gt;&lt;/h1&gt;
&lt;/p&gt;
&lt;p&gt;
Welcome to dotMath, the extensible OpenSource expression compiler for the .NET platform written entirely in C#.&amp;nbsp;&amp;nbsp;Offering speed through compilation of expressions, the library allows for variable handling, an entire function library and the ability to add your own functions.&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
If you need to evaluate fixed or variable expressions, dotMath is your solution:&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;fixed expression example:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(sin(5)* cos(4/5)) / 3&lt;/i&gt;&lt;br/&gt;
&lt;i&gt;variable expressions example: (sin(a)* cos(b/a)) / c&lt;/i&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
Download the Version 1.0 release here... [release:875]&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Getting%20Started%20-%20How%20to%20use%20dotMath"&gt;Getting Started - How to use dotMath&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=Built-in%20functions%20and%20operators"&gt;Built-in functions and operators&lt;/a&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=dotMath&amp;title=The%20History%20of%20dotMath"&gt;The History of dotMath&lt;/a&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br/&gt;
&lt;/p&gt;
</description><author>sdhebert</author><pubDate>Wed, 25 Oct 2006 21:09:07 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20061025090907P</guid></item></channel></rss>