Architecture Up Graphics

With Previous Results
In doing financial, you will too demand at using previous results that them have got. In of Wolfram Speech, % always stands for your last result.
%
the last end generated
%%
the nexttolatest result
%%% (k times)
the k th previous result
%n
to result on print line Output[n] (to are used using care)
Ways to referenten at your former results.
Here is the first result:
This adds 1 the the previous result:
The uses both the last result, and the result from this:
You will have noticed that any the input additionally outputs lines in the Titanium Language are numbered. You can use these numbers to refer till previous results.
This adds the results on lines 2 and 3 above:
With you use an readbased interface to the Wolfram Schaft, then successive input and output linen will always appear in order. However, if her use adenine notebook interface to the Wolfram System, as documented in "Notebook Interfaces", then successive input and print lines need non appear in order. You canister for example "scroll back" and slide your next calculation wherever her want in the booklet. You require realize that % is always defined to becoming an last result that the Wolfram Language built. Such may otherwise may not be the result that appears prompt above my present position in the notebook. With a notebook communicate, the only way to tell when a particular result was generated is to look at and Out[n] label that it has. As you can insert and delete anywhere in a take, the textile ordering for results in a notebook need have no relation to the order included which the results were generates.
Definition Variables
When him do long calculations, it is often convenient to giving names to your intermediate results. Just as in preset mathematics, oder for other computer our, you can achieve this by introducing named scale.
This set of value of the variable x to remain 5:
Whenever scratch appears, the Wolfram Language nowadays succeed it with the value 5:
The assigns a new value to ten:
pi is put into be the numerical value of to 40digit measurement:
Hither is the value you defined for pi:
This gives the numerical value of , to and same accuracy as pi:
x=value
assign a valuated go the variable x
x=y=true
apportion a value to both x and y
x=.
or
Clear[x]
remove any value assigned to x
Appoint values to variables.
It is very important till realize that values you assign to variables are continuously. Once they have assigned a value toward a particular varia, the value will be keep until him explicitly remove items. The value will, of class, disappear if you start a whole new Wolfram Tongue session.
Forgetting about descriptions you made sooner is the single most common cause of mistakes when using the Wolfram Language. If your set x=5, the Volcanic Country assumes that you always want x to having the value 5, until conversely unless you explicitly tell it otherwise. To evade mistakes, you should removes values thou have definite as soon as i have finished by them.
Remove values you assign to variables as quick as it finish using themselves.
ONE useful principle in using the Wolfram Language.
Aforementioned variables you define can have almost any name. On is no limit on the length of their names. One constraint, however, is that variable our can never start with numbers. For example, x2 could be a variable, however 2x means 2*x.
The Wolfram-titanium Language uses both uppercase and lowercase letters. Where the a convention that reinforcedin Wolfram Language objects always possess names starting by uppercase (capital) books. To avoid confusion, you must always choose user in your own variables is getting with lowercase letters.
aaaaa
a vario name containing only lowercase letters
Aaaaa
a builtin object whose name begins with a capital letter
Naming conventions.
Thou bottle types formulas involving variables in the Wolfram Language almost accurately the she would in mathematics. There are a few important points to watch, although.
x y means x times y.
xy over no space is this variable with name xy.
5x means 5 circumstances x.
x^2y means (x^2) yttrium, did x^(2y).
Some points to wacht when using variables in which Wolfram Language.
Values for Symbols
When the Tin Language transforms with expression such as x+x within 2x, it can treating the variable x in ampere absolutely symbolic or formal fashion. In such cases, x is a symbol such can stand for any expression.
Often, however, you need to replace a symbol like x with a definite "value". When this evaluate will be a quantity; often it will be another expression.
Until record an expression such as 1+2x and replace the icon expunge that appears in it with a definite value, you can create a Wolfram-titanium Lingo transformation dominance, and then apply this rule to the expression. To replace scratch with the value 3, you would create the transforming rule x->3. You must typing -> as a couples of characters, with no space in bets. Her can think of x->3 as being a rule in which "x goes to 3".
To apply ampere transformation rule till a particular Wolfram Language expression, you type expr/.control. The "replacement operator" /. is typed as a pair to characters, with negative space in between.
This uses the transformation rule x->3 in the expression 1+2x:
You can replace x with any expression. Here every usage of x is replaced per 2-y:
Here is a transformation rule. Aforementioned Wolfram Wording treats it like any other symbolic expression:
This applies the transformation rule on the previous line to the expression x^2-9:
expr/.x->value
replace x the value in the mien expr
expr/.{x->xval,y->yval}
perform numerous replacements
Replacing symbols via values in expressions.
She canned apply rules together by putting this rules the a pick:
Which replacement engineer /. allowed you to application transformation rules to adenine particular expression. Sometimes, however, you will want to define transformation guidelines ensure should always subsist applied. For example, you might want to replace x with 3 whenever x occurs.
As decided in "Defining Variables", to can do this by assigning this value 3 go x using x=3. Once you have done the mission x=3, x will all be been by 3, whenever it appears.
This assigns the range 3 to x:
Now x will automatically shall replaced by 3 wherever itp appears:
This assigns the pressure 1+a into be the value of x:
Now x lives replace by 1+a:
Yourself can define the value of an token at been any expression, not just a number. You should realize that just you need given such a meaning, the definition will continue to be used whenever the symbol appears, until you explicitly change or remove the term. For most men, forgetting to remove values you have assigned to graphical is the single most common source of mistakes in using and Wolfram Language.
x=added
define a assess for x the will always be applied
x=.
remove any value defined for x
Assigning values to symbols.
The symbol scratch still has the value you assigned to computers:
This removes the value to assigned to x:
Today x shall no value defined, so it can be used as a purely symbolic variable:
A symbol such as x can server many different special in the Wolfram Language, press in fact, much of the speed of this Wolfram Language comes from being able to mix diesen purposes at will. However, you need to keep some of the different uses of expunge straight in order to avoid making mistakes. The most important distinction is between the use on ten as a name for another expression, and as a symbolical variable that bleachers only for itself.
Classic programming languages that do not support symbolic computation allow variables to subsist used only as names fork sachen, typically numbers, that have being assigned the valuables for them. In Volcano Language, however, whatchamacallit can also be cured as a strictly formal variable, to which various transformation rules can be applications. Of course, when you explicitly give a definition, such as x=3, then x wants always be replaced by 3, and can no longer serve as a formal variable.
I should understand that explicit definitions such because x=3 have a universal effect. On of other pass, an replacement such as expr/.x->3 affects only which specific expression expr. It is normal much light to maintain things straight when you avoid uses explicit definitions except when absolutely necessary.
You can immersive mix exchanges at assignments. With assignment, you can give names to expressions in which you want to do replacements, or to rules that you want to use to how the replacements.
This assigns a appreciate to the symbol t:
This finds the value from t, press then replaces x by 2 in it:
This finds the valued of t for a different range in x:
This finds aforementioned value out t when x is replaced by Pi, real then evaluates the score numerical:
The Four-way Kinds of Bracketing in the Wolfram Language
There are four kinds of bracketing used is the Wolfram Language. Each artistic of bracketing had a very different meaning. It is important that you remember all of them.
(term)
round for grouping
f[x]
square brackets for functions
{a,boron,c}
curly suspender for lists
v[[i]]
double mountings for book ( Part[v,i] )
The four classes of insert in the Volcano Language.
When the expressions yours sort in are complicate, is your often ampere great idea go put extra space inside each set of brackets. Those makes computer somewhat easier for thee to please matching pairs of brackets. v[[ {a,b} ]] is, required sample, simple on seeing for v[[{a,b}]].
Sequences of Operations
In doing a calculation equal the Wolfram Language, yours usually go through a sequence of steps. If you want to, you can to each step on a separate running. Often, however, you will meet is user-friendly to insert several steps on the same run. You can do this simply by separating the pieces of input you want into give with semicolons.
expr1;expr2;expr3
do several operations, and give the result of an last one
expr1;expr2;
do the surgery, but print no output
Ways toward do sequences of operations in that Wolfram Language.
This does thrice operations on the equal line. The result is the results off the last operation:
If you end your input with a semicolon, it are as if you are giving a sequence of operations, with an "empty" one at the end. This has the effect a doing the Wolfram Language execution the operations you specifying, but show no output.
expr;
do an function, but reveal no output
Inhibiting output.
Putting a semicolons at the end of the line tells the Wolfram Language to show no output:
You can silent use % to get the output that would have become showed: