Matlab 版 (精华区)
发信人: physics (致命的异常错误发生在 0BB4:2BAD), 信区: MathTools
标 题: 4(下次再续)
发信站: BBS 水木清华站 (Wed Nov 4 21:44:32 1998)
发信人: space (排骨教主), 信区: physics
标 题: math 教程(4)
发信站: BBS 曙光站 (Wed Jun 10 13:45:31 1998)
Printing a Mathematica Notebook
To print a notebook, pull down "File" to "Print", choose "OK" or "Print"
(right now choose "Cancel") and wait a few minutes for it to appear at a
local laser printer. To print only selected parts of a notebook, drag the
cursor across the brackets on the right side of the screen. Try this now
and get several brackets marked with a dark bar. After doing this, use
"Print Selection" or, if this command is unavailable, pull down "File" to
"Print" and you should see "Selection" marked in the box.
Before the next class, print out a copy of this notebook showing all of the
instructions below completed. Hand in the one printout for your
partnership, if you have one. (You may delete this "Windows Front End" port
ion of this section.)
Cells and Evaluation
The primary structural principle of Mathematica notebooks is their division
into cells. Notice that this cell's innermost brackets (on the right-hand
side of your screen) have a second bar on top. This second bar indicates
that Mathematica is prevented from trying to interpret its contents as
instructions; the cell is simply a text cell. Cells which we want
Mathematica to look at and evaluate should not be text cells, but instead
input cells. In this notebook, input cells appear in blue---although it is
possible to change the colors and background of all of the cells, both text
and input. First we will execute some input cells which are embedded in
the notebook already, and then we will have you start making your own input
cells.
To execute a cell, which means to ask Mathematica to evaluate it, use the
mouse to place the cursor anywhere in the cell and click once. You should
then see a blinking cursor. Then hold down shift and press the "Enter"
key. (Macintosh users need only press down the "Enter" key.) Then
Mathematica will execute the cell.
Let's see if Mathematica can do anything. Execute the following cell:
4*5^2+13
You may have noticed that Mathematica took some time figuring this
expression out. If so, don't be worried. The first time a Mathematica
session executes an input cell, the computer has to launch a separate
program, called the Mathematica Kernel, and starting up programs simply
takes time. Now that you have successfully executed a cell, read on
through the notebook and execute every input cell that you see.
Arithmetic Operations
In this section we explain how Mathematica operates as a simple scientific
calculator, evaluating expressions. We will describe operators, which are
usually symbols such as "+" which indicate to Mathematica that a certain
sort of task, or operation (in this case, addition), must be performed.
The arithmetic operators have standard calculator form ("+", "-", "*", "/",
and "^") and have standard mathematical precedence, meaning for instance
that multiplication and division are executed before addition and
subtraction. Exponentiation has more precedence than multiplication and
division, which have the same level of precedence, and these have more
precedence than addition and subtraction, which have the same level of
precedence. The expression "4*5^2+13" should execute "5^2" first, followed
by "4*(5^2)", finally followed by adding the "13".
4*5^2+13
Mathematica accepts some non-standard input forms for arithmetic. For
instance, the * may be omitted so that the multiplication is implied. Of
course, you still need a space so that Mathematica realizes that you do not
intend the number 45. Execute the following cell:
4 5^2+13
Mathematica also allows variables, for which we can use a letter ("x") or a
string of letters and numbers beginning with a letter ("my3rdvariable").
If you want to tell Mathematica to multiply a variable by a number, you
don't need to use a space between them if the number comes first.
3x + 5x
However, "x3" and "x5" are interpreted as two different variables (as if
the 3 and 5 were subscripts) and so the two are not combined. While the
cell above gives "8x" when executed, the cell below simply returns "x3+x5".
x3 + x5
--
我 就 要 回 来 了
我 就 要 明 明 白 白 的 告 诉 你
...........................................
※ 修改:.fzx 于 Aug 10 12:51:34 修改本文.[FROM: heart.hit.edu.cn]
※ 转寄:.紫 丁 香 bbs.hit.edu.cn.[FROM: sys08.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.413毫秒