<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>Math</title><revhistory><revision><revnumber>24</revnumber><date>2015-02-13 20:59:39</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>23</revnumber><date>2015-02-13 20:58:34</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>22</revnumber><date>2015-02-08 15:47:55</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>21</revnumber><date>2015-02-08 04:53:23</date><authorinitials>LKD70</authorinitials></revision><revision><revnumber>20</revnumber><date>2014-11-17 14:18:22</date><authorinitials>Romulus</authorinitials></revision><revision><revnumber>19</revnumber><date>2014-11-15 04:02:41</date><authorinitials>Inanna</authorinitials><revremark>Renamed from 'MathAndNumbers'.</revremark></revision><revision><revnumber>18</revnumber><date>2014-11-15 04:02:16</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>17</revnumber><date>2014-02-12 17:44:46</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>16</revnumber><date>2014-02-12 17:43:25</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>15</revnumber><date>2014-02-12 17:13:27</date><authorinitials>Inanna</authorinitials><revremark>Renamed from 'Math'.</revremark></revision><revision><revnumber>14</revnumber><date>2013-12-09 16:15:07</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>13</revnumber><date>2013-12-08 20:37:52</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>12</revnumber><date>2013-07-31 04:33:32</date><authorinitials>tech</authorinitials></revision><revision><revnumber>11</revnumber><date>2013-07-31 04:31:54</date><authorinitials>tech</authorinitials></revision><revision><revnumber>10</revnumber><date>2013-07-31 04:30:51</date><authorinitials>tech</authorinitials></revision><revision><revnumber>9</revnumber><date>2013-07-31 04:30:16</date><authorinitials>tech</authorinitials></revision><revision><revnumber>8</revnumber><date>2013-07-31 04:28:30</date><authorinitials>tech</authorinitials></revision><revision><revnumber>7</revnumber><date>2013-07-31 04:27:55</date><authorinitials>tech</authorinitials></revision><revision><revnumber>6</revnumber><date>2013-07-31 04:22:35</date><authorinitials>tech</authorinitials></revision><revision><revnumber>5</revnumber><date>2012-12-04 18:33:00</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>4</revnumber><date>2012-10-28 20:10:24</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>3</revnumber><date>2012-10-28 20:07:19</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>2</revnumber><date>2012-10-28 20:06:20</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>1</revnumber><date>2012-10-28 20:05:59</date><authorinitials>Inanna</authorinitials></revision></revhistory></articleinfo><para>The following functions can be used to perform arithmetic on objects and variables. </para><para>These should be written in the following formats: </para><itemizedlist><listitem override="none"><para><emphasis>variable.method(arguments), example - ... </emphasis> </para></listitem><listitem override="none"><para><emphasis>object.method(arguments), example - ... </emphasis> </para></listitem></itemizedlist><para>Click each method name in the table below for more details of it, with examples. </para><para><emphasis role="strong">Functions</emphasis> </para><informaltable><tgroup cols="5"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><colspec colname="col_3"/><colspec colname="col_4"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para><emphasis role="strong">Function </emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Type</emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Description </emphasis> </para></entry><entry align="center" colsep="1" nameend="col_4" namest="col_3" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="abs">abs</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns an absolute value for the number specified by the parameter val. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="acos">acos</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the arc cosine of the number specified in the parameter val, in radians. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="asin">asin</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the arc sine for the number specified in the parameter val, in radians. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="atan">atan</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the value, in radians, of the angle whose tangent is specified in the parameter val. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="atan2">atan2</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the angle of the point y/x in radians, when measured counterclockwise from a circle's x axis (where 0,0 represents the center of the circle). </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="ceil">ceil</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the ceiling of the specified number or expression. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="cos">cos</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the cosine of the specified angle in radians. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="exp">exp</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the value of the base of the natural logarithm (e), to the power of the exponent specified in the parameter x. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="floor">floor</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the floor of the number or expression specified in the parameter val. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="log">log</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the natural logarithm of the parameter val. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="max">max</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Evaluates val1 and val2 (or more values) and returns the largest value. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="min">min</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Evaluates val1 and val2 (or more values) and returns the smallest value. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="pow">pow</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns base to the power of pow. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="random">random</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns a pseudo-random number n, where 0 &lt;= n &lt; 1. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="round">round</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Rounds the value of the parameter val up or down to the nearest integer and returns the value. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="sin">sin</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the sine of the specified angle in radians. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="sqrt">sqrt</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the square root of the specified number. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para><link linkend="tan">tan</link> </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Computes and returns the tangent of the specified angle. </para></entry></row></tbody></tgroup></informaltable><section><title>abs</title><para><emphasis role="strong">Usage:</emphasis> abs(number) </para><para>Computes and returns an absolute value for the number specified by the parameter val. </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo abs(-123456) </para><para>echo abs(123456) </para><para><emphasis role="strong">Result:</emphasis> </para><para>123456 </para><para>123456 </para><itemizedlist><listitem override="none"/></itemizedlist></section><section><title>acos</title><para><emphasis role="strong">Usage:</emphasis> acos(number.decimal) </para><para>Computes and returns the arc cosine of the number specified in the parameter val, in radians. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo acos(0.75) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 0.7227342478134157 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>asin</title><para><emphasis role="strong">Usage:</emphasis> asin(number.decimal) </para><para>Computes and returns the arc sine for the number specified in the parameter val, in radians. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo asin(0.75) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 0.848062078981481 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>atan</title><para><emphasis role="strong">Usage:</emphasis> atan(Number) </para><para>Computes and returns the value, in radians, of the angle whose tangent is specified in the parameter val. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo atan(7) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 1.4288992721907328 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>atan2</title><para><emphasis role="strong">Usage:</emphasis> atan2(FirstNumber, SecondNumber) </para><para>Returns a string comprising the characters represented by the Unicode character codes in the parameters. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo atan2(7,3) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 1.1659045405098132 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>ceil</title><para><emphasis role="strong">Usage:</emphasis> ceil(Number.Decimal) </para><para>Returns the ceiling of the specified number or expression. Basically this means return the number rounded up to next whole number </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo ceil(4.1) </para><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 5 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>cos</title><para><emphasis role="strong">Usage:</emphasis> cos(angle) </para><para>Computes and returns the cosine of the specified angle in radians. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo cos(7) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 0.7539022543433046 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>exp</title><para><emphasis role="strong">Usage:</emphasis> exp(number) </para><para>Returns the value of the base of the natural logarithm (e), to the power of the exponent specified in the parameter x. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo exp(7) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 1096.633158428458 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>floor</title><para><emphasis role="strong">Usage:</emphasis> floor(Number.decimal) </para><para>Returns the floor of the number or expression specified in the parenthesis... Floor is the whole number part, without the decimals. Basically means chop the decimal portion of the number off. </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo floor(1234.56) </para><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 1234 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>pow</title><para><emphasis role="strong">Usage:</emphasis> pow(base, exponent) </para><para>Computes and returns base to the power of pow. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo pow(7, 3) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 343 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>max</title><para><emphasis role="strong">Usage:</emphasis> max(FirstValue, SecondValue) </para><para>Evaluates val1 and val2 (or more values) and returns the largest value. </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo max( city.troop.scouter, 100k ) </para><para><emphasis role="strong">Result:</emphasis> </para><para>If city.troop.scouter (the current number of scouts in the city) &lt; 100k, then max( city.troop.scouter, 100k ) will return the number of scouts in city. If city.troop.scouter &gt;= 100k then it will return 100000 </para><itemizedlist><listitem override="none"/></itemizedlist></section><section><title>min</title><para><emphasis role="strong">Usage:</emphasis> min(FirstValue, SecondValue) </para><para>Evaluates val1 and val2 (or more values) and returns the smallest value. </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo min(city.resource.food.amount,99999999) </para><itemizedlist><listitem override="none"/></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><para>this will return whichever is smaller, 99,999,999 or the current amount of food in the city </para></section><section><title>random</title><para><emphasis role="strong">Usage:</emphasis> random() </para><para>Returns a pseudo-random number n, where 0 &lt;= n &lt; 1. </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo round(random()*10) </para><itemizedlist><listitem override="none"/></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><para>a random number between 0 and 9 </para><itemizedlist><listitem override="none"/></itemizedlist></section><section><title>round</title><para><emphasis role="strong">Usage:</emphasis> round(number.decimal,[optional] places) </para><para>Rounds the value of the parameter val up or down to the nearest integer and returns the value. Optional argument to specify precision (or number of decimal places). </para><para><emphasis role="strong">Example:</emphasis> </para><para>echo round(6.66666666666666666666) </para><para>echo round(6.66666666666666666666,1) </para><para>echo round(6.66666666666666666666,2) </para><para>echo round(6.66666666666666666666,3) </para><itemizedlist><listitem override="none"/></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><para>7 </para><para>6.7 </para><para>6.67 </para><para>6.667 </para></section><section><title>sin</title><para><emphasis role="strong">Usage:</emphasis> sin(angle) </para><para>Computes and returns the sine of the specified angle in radians. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo sin(3) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 0.1411200080598672 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>sqrt</title><para><emphasis role="strong">Usage:</emphasis> sqrt(number) </para><para>Computes and returns the square root of the specified number. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo sqrt(16) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 4 (City Name) - Script stopped </para></listitem></itemizedlist></section><section><title>tan</title><para><emphasis role="strong">Usage:</emphasis> tan(angle) </para><para>Computes and returns the tangent of the specified angle. </para><para><emphasis role="strong">Example:</emphasis> </para><itemizedlist><listitem override="none"><para>echo tan(4) </para></listitem></itemizedlist><para><emphasis role="strong">Result:</emphasis> </para><itemizedlist><listitem override="none"><para>(City Name) - 1.1578212823495775 </para></listitem></itemizedlist><para>(City Name) - Script stopped </para><!--rule (<hr>) is not applicable to DocBook--><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://guide.neatportal.com/wiki/Math/wiki/CategoryFunctions#">CategoryFunctions</ulink> </para></section></article>