Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 8b2b1fb157760a0d31e072e140388824 > files > 111

gri-2.8.0-1mdk.i586.rpm

<html>
<head>
<title>Gri: Mathematics</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="FF0000">
<!-- newfile Mathematics.html "Gri: Mathematics" "Programming Gri" --> 

<!-- @node   Mathematics, rpn Mathematics, Loops, Programming -->
<a name="Mathematics" ></a>

<img src="./resources/top_banner.gif" usemap="#navigate_top" border="0">
<table summary="top banner" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" valign="top">
<font size=-1>
<br>
Chapters:
</br>
&nbsp;&nbsp;<a href="Introduction.html">1: Introduction</a><br>
&nbsp;&nbsp;<a href="SimpleExample.html">2: Simple example</a><br>
&nbsp;&nbsp;<a href="InvokingGri.html">3: Invocation</a><br>
&nbsp;&nbsp;<a href="GettingMoreControl.html">4: Finer Control</a><br>
&nbsp;&nbsp;<a href="X-Y.html">5: X-Y Plots</a><br>
&nbsp;&nbsp;<a href="ContourPlots.html">6: Contour Plots</a><br>
&nbsp;&nbsp;<a href="Images.html">7: Image Plots</a><br>
&nbsp;&nbsp;<a href="Examples.html">8: Examples</a><br>
&nbsp;&nbsp;<a href="Commands.html">9: Gri Commands</a><br>
&nbsp;&nbsp;<a href="Programming.html">10: Programming</a><br>
&nbsp;&nbsp;<a href="Environment.html">11: Environment</a><br>
&nbsp;&nbsp;<a href="Emacs.html">12: Emacs Mode</a><br>
&nbsp;&nbsp;<a href="History.html">13: History</a><br>
&nbsp;&nbsp;<a href="Installation.html">14: Installation</a><br>
&nbsp;&nbsp;<a href="Bugs.html">15: Gri Bugs</a><br>
&nbsp;&nbsp;<a href="TestSuite.html">16: Test Suite</a><br>
&nbsp;&nbsp;<a href="Acknowledgments.html">17: Acknowledgments</a><br>
&nbsp;&nbsp;<a href="License.html">18: License</a><br>
<br>
Indices:</br>
&nbsp;&nbsp;<a href="ConceptIndex.html"><i>Concepts</i></a><br>
&nbsp;&nbsp;<a href="CommandIndex.html"><i>Commands</i></a><br>
&nbsp;&nbsp;<a href="BuiltinIndex.html"><i>Variables</i></a><br>
</font>
<td width="500" valign="top">
<map name="navigate_top">
<area alt="index.html#Top" shape="rect" coords="5,2,218,24" href="index.html#Top">
<area alt="Programming.html#Programming" shape="rect" coords="516,2,532,24" href="Programming.html#Programming">
<area alt="Gri: Loops" shape="rect" coords="557,2,573,24" href="Loops.html">
<area alt="Gri: Reverse Polish Mathematics" shape="rect" coords="581,2,599,24" href="ReversePolishMath.html">
</map>
<map name="navigate_bottom">
<area alt="index.html#Top" shape="rect" coords="5,2,218,24" href="index.html#Top">
<area alt="Gri: Reverse Polish Mathematics" shape="rect" coords="581,2,599,24" href="ReversePolishMath.html"></map>
<h2>10.8: Mathematics</h2>

Gri lets you do some simple mathematical manipulations on your
column and grid data.
<p>
<h3>10.8.1: Column data</h3>
The column operators are `<font color="#82140F"><code>=</code></font>', `<font color="#82140F"><code>+=</code></font>', `<font color="#82140F"><code>-=</code></font>', `<font color="#82140F"><code>*=</code></font>',
`<font color="#82140F"><code>/=</code></font>', `<font color="#82140F"><code>^=</code></font>' (exponentiation) and `<font color="#82140F"><code>_=</code></font>' (logarithm).  There
must be spaces before and after the operators, but no space between the
2 letters of the operators. The operations may be applied not only to
`<font color="#82140F"><code>x</code></font>' and `<font color="#82140F"><code>y</code></font>' as shown, but also to `<font color="#82140F"><code>z</code></font>' (used to hold data
to be contoured or written as symbols), and `<font color="#82140F"><code>u</code></font>' and `<font color="#82140F"><code>v</code></font>' (used
to store vector fields).
<p>
The axis scales are <b>not</b> changed by mathematical operations on the
columns, regardless of whether the scales were set manually or by Gri
command (see <a href="AxisScaling.html#AxisScaling">Axis Scaling</a>).
<p>
Elements of columns are available by the `<font color="#82140F"><code>@</code></font>' reverse polish
operator (see <a href="ReversePolishMath.html#rpnMathematics">rpn Mathematics</a>).
<p>
Examples:
<ul>
<li>
To multiply all the x data by 10, use `<font color="#82140F"><code>x *= 10</code></font>'; to add 5 to each
y-value, use `<font color="#82140F"><code>y += 5</code></font>'.
<li>
To set all the y data to 10, do `<font color="#82140F"><code>y = 10</code></font>'.  (This will only work if
you've already read column data.)
</ul>
<p>
<h3>10.8.2: Grid data</h3>
Various commands let you alter grid data as used in contouring
(see <a href="ContourPlots.html#ContourPlots">Contour Plots</a>).  Possible commands are as follows.
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
grid data = number
grid data += number
grid data -= number
grid data *= number
grid data /= number
grid data ^= number # take data to power 'number'
grid data _= number # take log base 'number'
grid x = number
grid x += number
#... others as in `grid data'
grid y = number
grid y += number
#... others as in `grid data'
</font></PRE>
</TD>
</TR>
</TABLE>
<p>

<h4>10.8.2.1: Image data</h4>
Various commands let you alter image data (see <a href="Images.html#Images">Images</a>.).
Possible commands are as follows.
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
image += number
image -= number
image *= number
image /= number
image ^= number # power
image _= number # logarithm
</font></PRE>
</TD>
</TR>
</TABLE>
<p>
<h4>10.8.2.2: Image grayscale/colorscale</h4>
Various commands let you alter image data (see <a href="Images.html#Images">Images</a>).
Possible commands are as follows.
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
image grayscale += number
image grayscale  -= number
image grayscale  *= number
image grayscale  /= number
image grayscale  ^= number # power
image grayscale  _= number # logarithm
image colorscale += number
image colorscale  -= number
image colorscale  *= number
image colorscale  /= number
image colorscale  ^= number # power
image colorscale  _= number # logarithm
</font></PRE>
</TD>
</TR>
</TABLE>
<p>
<h4>10.8.2.3: Variables</h4>
Possible commands are:
<p>
<TABLE SUMMARY="Example" BORDER="0" BGCOLOR="#efefef" WIDTH="100%">
<TR>
<TD>
<PRE>
<font color="#82140F">
.variable. = number
.variable. += number
.variable. -= number
.variable. *= number
.variable. /= number
.variable. ^= number # power
.variable. _= number # logarithm
</font></PRE>
</TD>
</TR>
</TABLE>
<p>

</table>
<img src="./resources/bottom_banner.gif" usemap="#navigate_bottom" border="0">

</body>
</html>