<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to your application</title><link>https://sourceforge.net/p/algebrain/wiki/your%2520application/</link><description>Recent changes to your application</description><atom:link href="https://sourceforge.net/p/algebrain/wiki/your%20application/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 05 Dec 2013 15:31:59 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/algebrain/wiki/your%20application/feed" rel="self" type="application/rss+xml"/><item><title>your application modified by Chris DeGreef</title><link>https://sourceforge.net/p/algebrain/wiki/your%2520application/</link><description>&lt;div class="markdown_content"&gt;&lt;h2&gt;Include the JAR file&lt;/h2&gt;
&lt;p&gt;Only one JAR file is needed to support the Algebrain features: algebrain-1.0.2.jar.  The version will change over time.  Use what ever JAR you downloaded.  This JAR contains all of the .class files.  It does not contain the source (.java).&lt;/p&gt;
&lt;h2&gt;Interacting with Equ&lt;/h2&gt;
&lt;p&gt;This is the main class for Algebrain. Create an instance of this class and&lt;br /&gt;
send it an evaluate() message. The result is either a Double or a String&lt;br /&gt;
depending on the final function that was executed - almost always it will be&lt;br /&gt;
a double.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Equ&lt;/span&gt; &lt;span class="n"&gt;equ&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Equ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Double&lt;/span&gt; &lt;span class="n"&gt;sine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Double&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;equ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;sin(0.15)&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;pre&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Registering your own functions&lt;/h2&gt;
&lt;p&gt;Many functions are provided in Algebrain and nothing special needs to be done in order to use them.&lt;/p&gt;
&lt;p&gt;You can also register your own functions and operators by calling the static methods &lt;code&gt;registerFunction&lt;/code&gt; and &lt;code&gt;registerOperator&lt;/code&gt;. These add to a static Map so there are then available for the duration of your application.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Equ&lt;/span&gt; &lt;span class="n"&gt;equ&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Equ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;equ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registerFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;min&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// The following answer is 1.&lt;/span&gt;
&lt;span class="n"&gt;final&lt;/span&gt; &lt;span class="n"&gt;Double&lt;/span&gt; &lt;span class="n"&gt;sine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Double&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;equ&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;min(1,2,3)&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;pre&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Variable support for your equations&lt;/h2&gt;
&lt;p&gt;A support instance can be handed to an instance of &lt;code&gt;Equ &lt;/code&gt;with the &lt;code&gt;setSupport()&lt;/code&gt; method. This must be done prior to calling evaluate. When a variable is found in the equation (i.e.: not a known function, like &lt;code&gt;x&lt;/code&gt; or &lt;code&gt;myvar&lt;/code&gt;) then the support instance is asked to instantiate the variable. It is expected that it will do what is necessary to come up with it. The test cases show a support instance that maintains a local Map of variable name / value pairs. But a database could be used as well, for instance.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris DeGreef</dc:creator><pubDate>Thu, 05 Dec 2013 15:31:59 -0000</pubDate><guid>https://sourceforge.net091b9405aa32d683285019a131bd1c8485aa7587</guid></item></channel></rss>