![]() |
Variables, Expressions, and Functions |
A variable is name to which you can assign a value. The variable name is a text string that must begin with a letter and it is case sensitive, so the strings "Avar" and "avar" could be used to represent different variables. A variable name can contain digits but it cannot start with a digit. You may also use subscripts on variable names. To define a variable, type the name followed by <ctrl> x, then the value followed by <ctrl> z. <ctrl> x produces the string := and is the signal that you are defining something. <ctrl> z causes the applet to evaluate the expression, thus assigning the value to the name. Example: The key strokes
Example: The three lines below are made by typing
Note: The applet defines the variables e and The symbol for pi is obtained by typing <ctrl>p.
Example You may define functions of any number of variables, and the function may return a real number or a vector. Example Example Evaluating the expression yields the partial derivative with respect to x of the function f. The symbol is made with the key strokes D <ctrl> j x <up arrow> f Example If a function f is defined using local variables named a and b, then differentiating f with respect to x will yield 0. However, the local variables can be renamed, as illustrated below. Example The built-in functions such as sin and cos do not have a named local variable. Differentiating a built-in function with respect to a variable has the effect of naming the local variable and then taking the derivative. Example Evaluating the expression yields the nth partial derivative of f with respect to x, and the symbol is made with the key strokes D <ctrl> k n <right arrow> x <up arrow> f The expression first takes the partial with respect to x, then with respect to y, and that symbol is made by typing D <ctrl> j x , y <up arrow> <up arrow> f Example: Three ways to compute the second derivative of sine Example Functions may be added, subtracted, multiplied and divided like numbers. Example Functions may also be composed, as in the following example. (Composition symbol is obtained by typing <ctrl> c.) Example Functions of more than one variable and vector valued functions may also be combined by these operations, provided the dimensions of the dimensions of the domains and codomains are such that the operation is defined. |
![]() ![]() ![]() ![]() ![]() ![]() |