https://wiki.inspired-lua.org/index.php?title=math.evalStr&feed=atom&action=historymath.evalStr - Revision history2024-03-30T02:12:26ZRevision history for this page on the wikiMediaWiki 1.33.0https://wiki.inspired-lua.org/index.php?title=math.evalStr&diff=934&oldid=prevAdriweb at 15:50, 15 May 20132013-05-15T15:50:43Z<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 15:50, 15 May 2013</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><span style="font-weight: bold;">math.eval</span> is a math library extension. <br> </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><span style="font-weight: bold;">math.eval</span> is a math library extension. <br> </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{{Since|3.<del class="diffchange diffchange-inline">0</del>}}</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{Since|3.<ins class="diffchange diffchange-inline">2</ins>}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Adriwebhttps://wiki.inspired-lua.org/index.php?title=math.evalStr&diff=933&oldid=prevAdriweb at 15:50, 15 May 20132013-05-15T15:50:35Z<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 15:50, 15 May 2013</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><span style="font-weight: bold;">math.eval</span> is a math library extension. <br> </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><span style="font-weight: bold;">math.eval</span> is a math library extension. <br> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">{{Since|3.0}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The function calls the math server with the specified arguments and returns the result if possible, as a string.<br> </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The function calls the math server with the specified arguments and returns the result if possible, as a string.<br> </div></td></tr>
</table>Adriwebhttps://wiki.inspired-lua.org/index.php?title=math.evalStr&diff=858&oldid=prevAdriweb: Created page with "<span style="font-weight: bold;">math.eval</span> is a math library extension. <br> The function calls the math server with the specified arguments and returns the result if po..."2012-10-06T20:56:49Z<p>Created page with "<span style="font-weight: bold;">math.eval</span> is a math library extension. <br> The function calls the math server with the specified arguments and returns the result if po..."</p>
<p><b>New page</b></p><div><span style="font-weight: bold;">math.eval</span> is a math library extension. <br> <br />
<br />
The function calls the math server with the specified arguments and returns the result if possible, as a string.<br> <br />
<br />
This function sends an expression or command to the TI-Nspire&nbsp;math server for eval-uation. The input expression must be a string that the TI-Nspire&nbsp;math server can&nbsp;interpret and evaluate. The evaluation is performed using the current document settings,&nbsp;which can be overriden by math.setEvalSettings. NOTE: All evaluations are performed&nbsp;at full precision regardless of the document settings or overrides. <br />
<br />
Beginning with platform.apiLevel = '2.0' (OS 3.2), the evaluation is performed using the current document settings, except that all evaluations are performed at full precision in approximate mode. The current document settings can be overriden by math.setEvalSettings. <br> If the math server evaluates the expression successfully, it returns the results as a fundamental Lua data type. <br> If the math server cannot evaluate the expression because of a syntax, simplification, or semantic error, eval returns two results: nil and an error number meaningful to the math server. (The error numbers are documented in the TI-Nspire Reference Guide - Error Codes and Messages for math.eval.)<br> If the math server calculates a symbolic result, it cannot be represented as a fundamental Lua type, so eval returns nil and the string "incompatible data type." <br> <br />
<br />
<br> <br />
<br />
'''Example'''&nbsp;: To evaluate ''f1'' for a given value in x, the parameter x must be converted to a string, and then any embedded "e" must be replaced with Unicode character U+F000. <br> <br />
<br />
<source lang="lua">local mx = tostring(x):gsub("e", string.uhar(0xF000))<br />
local expr = "f1(" .. mx .. ")"<br />
return math.evalStr(expr)</source> <br />
<br />
<br> <br />
<br />
== Syntax ==<br />
<br />
math.'''evalStr(expression)'''<br> evaluates "expression" (can contain TI-Basic arguments) and returns a result if possible, as a string.<br> <br />
<br />
Expression can contain everything a TI-Basic function can contain. You can seperate statements using ":". <br> It can also contain calls to user defined functions in the document, or functions in global libraries. <br />
<br />
<br> <br />
<br />
== Example ==<br />
<br />
<source lang="lua">math.evalStr("sqrt(16)") -- returns "4"</source> <br />
<br />
<br> <br />
<br />
== See also ==<br />
<br />
[[math.eval]] <br />
<br />
[[Category:Extended_Standard_Library]]</div>Adriweb