1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<HTML>
<HEAD>
<TITLE>Assignments</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<P><A NAME="assignments"></A>
<font size=+3 color="green"><B>Assignments</B></font></P>
<P>
An assignment stores the value(s) of an expression into a
<font size="-1" face="Arial black" color="red">EXTREMA</font> variable. An
assignment has the form: <CODE>variable = expression</CODE>
where <code>expression</code> is some combination of
constants, variables, functions, and operators. For example:</P>
<font color="blue"><PRE>
Y=A*COSD(X/10)+3.5*SIND(X/12)+C*EXP(-X)
</PRE></font>
<P>
The type of variable generated by an assignment is determined by the
expression. If the right hand side of the assignment evaluates to a character string,
the variable will be a character variable, while if it evaluates to a numeric value or
values, the variable will be a numeric variable. In this case, the shape of the right
hand side determines whether it is a scalar, vector or matrix. You can also mix numeric
and character, in which case the result will be numeric. For example:</p>
<font color="blue"><pre>
A = 2
B = 3
T = 'A+B'
C = 3*T
</pre></font>
<p>
and <font color="blue"><code>C</code></font> will be a numeric scalar variable with the
value <code>15</code>.</p>
<P>
Input is limited to <code>255</code> characters, so to have expressions
that are longer, use character variables to store its pieces and the <code>
<a href="../Functions/evaluate.htm">EVALUATE</a></code> function to
evaluate the expression numerically. For example:</P>
<font color="blue"><PRE>
F1 = '2.5*COS(X/10)+3.5*SIN(X/12)+63.7*EXP(X/45)'
F2 = '1.234567*MOD(X,100)+SIN(X/1000)*EXP(X/200)'
F3 = '3.56789*X^2-2.34567*X+23.456'
F = 'F1+F2+F3'
Y = EVALUATE(F)
</PRE></font>
<p>
You can use the <code><a href="../Functions/expand.htm">EXPAND</a></code>
function to expand all the parts of a string. For example, with the above variable definitions,
<font color="blue"><CODE>=EXPAND(F)</CODE></font> will display:</P>
<font color="blue"><PRE>
(2.5*COS(X/10)+3.5*SIN(X/12)+63.7*EXP(X/45))+(1.234567*MOD(X,100)+SIN(X/1000)*EXP(X/200))+(3.56789*X^2-2.34567*X+23.456)
</PRE></font>
<P>
<a href="Expression.htm"><img src="../shadow_left.gif">
<font size="+1" color="olive">Expressions</font></a><br />
<a href="ExpressionS02.htm"><img src="../shadow_right.gif">
<font size="+1" color="olive">String assignments</font></a>
</P>
</BODY>
</HTML>
|