Running Java applets
performances, instructions, examples
(Roberto Bigoni - May 2015)
SuperCalculator, unlike an ordinary calculator, can perform calculations on integer, rational, real and complex numbers with the desired precision.
Calculations on integer and rational numbers, represented by fractions or by repeating decimals, are always exact.
Integers can be input as binary or hexadecimal: in this case the sequence of digits must end
with @b
(or @B
) or @h
(or @H
).
Example: 1011000111011111101@b
; 12ABCEF01@H
.
Rational numbers can be input as fractions or repeating decimals.
In this case the repeated digits must be written between square brackets
([...]). Example: 1.2[34].
The decimal separator in real and rational numbers is the period; commas are not allowed: commas act only as separators between the items of a list.
Real numbers can be input in exponential notation. Example: 1.234e-5
.
The constants
selector allows you to enter directly into the input field the values of the most
common mathematical and physical constants.
Other constants can be stored in memory for further usage.
When calculations generate real numbers, results will be approximated to the number of digit written in the accuracy field (by default 6).
Obviously, if this number is too high, the computing time may become intolerable.
The imaginary unit is written as
I
or i
: Examples 1+I; 2/3-3/2i; 1.2+3.4i; (2+3I)^2; Sqrt[1-I]
.
It is possible to make some calculations on matrices and
on vectors. Vectors can be written as lists and the matrices
as lists of lists.
Example: Det[{{1,2,3},{0,1/2,-3},{a,b,0}}]
.
These objects can also be input using the button matrix
in the U.I.
Square matrices (if not singular) and vectors can be used together to obtain solutions of a systems of linear equations.
It is possible to define functions of one or more variables, assigning their expression to arbitrary identifiers.
One can get tables and graphs of real functions.
One can describe and draw simple plane geometric figures.
The operators
selector allows you to enter directly into the input field the names of the most
common mathematical functions and operators.
You can get documentation on the use of an operator by typing the question mark ? followed by the name of the operator
or by writing Help
followed by a pair of square brackets with the operator's name in quotes.
Examples: ?integral; Help["Integral"]
.
Input and output
In the input field
you can write expressions
that must be immediately evaluated. These expressions must be typewritten
using the standard operation signs (see below) and, eventually, parentheses.
After, click the execute
button or push the keys Alt+Enter
.
You can also write two or more statements separated by a semicolon (;).
Examples: 100!; 100!!; 100!/100!!
f[x]:=x^2-1; Graph[x,f[x],-2,2]
c=Circ[(0,0),1]; Draw[c]
.
In the input field
you can too declare a function
or assign a constant value. In these cases
execute
does'nt generate an explicit result but only stores
the function or the constant.
However, every activation of the execute
button writes,
in the output field, the expression in the input field and, below,
the result of the evaluation. These two lines are numbered so you can get them
using the commands In
and Out
.
To set a new calculation, you can click on the button new input
or the pair of keys Alt+End
.
You can download and save the sequence of inputs of the current session in a *.txt
by clicking the button
download input
.
You can download and save the sequence of outputs of the current session in a Html
page by clicking the button
download output
.
Since images and tables are generated in separate frames, if you want insert an image or a table in this page, you
must explicitly save these outputs by clicking the button save
of the frame.
Immediate expressions, declarations of function, assignments of constant can contain the following operation signs:
sign | operation |
---|---|
+ | addition |
- | subtraction |
* | multiplication(or blank space) |
/ | real division |
^ | power |
! | factorial |
The following operation signs work only on integer operands.
sign | operation |
---|---|
: | integer division |
% | remainder of integer division |
!! | double factorial |
& | and |
| | or |
# | xor |
The following operation signs work on logical operands.
sign | operation |
---|---|
- | not |
& | and |
| | or |
# | xor |
The priority in the evaluation of an expression is given by parentheses, eventually nested.
Expressions may contain the following constants.
(Physical constants have precision limited to their experimental values.)
constant | name |
---|---|
PI | greek pi |
E | Euler's number |
PHI | golden number |
I | imaginary unit |
TRUE | boolean true value |
FALSE | boolean false value |
GAMMA | Euler-Mascheroni constant |
G | gravitational constant |
PLANCK | Planck's constant |
C | speed of light in vacuum |
AVOG | Avogadro's constant |
R | ideal gas constant |
BOLTZ | Boltzmann constant |
ELM | electron rest mass |
ELC | charge of an electron |
PRM | proton rest mass |
PRC | charge of a proton |
EPS0 | vacuum permittivity |
MU0 | vacuum permeability |
RYDB | Rydberg constant, |
BOHR | Bohr Radius |
COMPTON | Compton wavelength |
STEFAN | Stefan-Boltzmann constant |
SG | Standard acceleration of gravity on the Earth's surface |
ATM | Standard Atmosphere |
In the input field you can call the following functions that require only one real or complex argument (exceptionally two in powers, radices and logarithms). If the argument is represented by x, it must be real; if the argument is represented by z it can be real or complex. You can obtain tables or graphs only for real function of real variable.
function | name | example |
---|---|---|
Id[z] | identity | Id[PI]; Id[i] |
Int[x] | integer part | Int[PI] |
Frac[x] | fractional part | Frac[PI] |
Abs[z] | absolute value | Abs[1+i] |
Rec[z] | reciprocal (multiplicative inverse) | Rec[1+i] |
Arg[z] | argument of a complex | Arg[3+4i] |
Real[z] | real part of a complex | Real[3+4i] |
Im[z] | imaginary part of a complex | Im[3+4i] |
Sqr[z] | square | Sqr[PI]; Sqr[1+i] |
Cube[z] | cube | Cube[PI]; Cube[1+i] |
Sqrt[z] | square root | Sqrt[PI]; Sqrt[1+i] |
Cubert[z] | cube root | Cubert[PI]; Cubert[1+i] |
Nrt[x,n] | n-th root (n natural ≥ 2) | Nrt[8,3] |
Fact[z] | factorial | Fact[100]; Fact[PI]; Fact[[1+i] |
Sin[z] | circular sine | Sin[PI/2]; Sin[ArcSin[2]] |
Cos[z] | circular cosine | Cos[PI/4]; Cos[ArcCos[2]] |
Tan[z] | circular tangent | Tan[PI/4]; Tan[1+i] |
Sec[z] | circular secant | Sec[PI/3]; Sec[1+i] |
Cosec[z] | circular cosecant | Cosec[PI/2]; Sec[1+i] |
Cotan[z] | circular cotangent | Cotan[PI/4]; Cotan[1+i] |
ArcSin[z] | circular arcsine | ArcSin[1/2]; ArcSin[1+i] |
ArcCos[z] | circular arccosine | ArcCos[1/2]; ArcCos[1+i] |
ArcTan[z] | circular arctangent | ArcTan[Sqrt[3]]; ArcTan[1+i] |
Exp[z] | natural exponential | Exp[-2]; Exp[i] |
Ln[z] | natural logarithm | Ln[Sqr[E]]; Ln[1+i] |
Log[β,z] | base β logarithm | Log[2,16]; Log[i,Cube[i]] |
Sinh[z] | hyperbolic sine | Sinh[1]; Sinh[1+i] |
Cosh[z] | hyperbolic cosine | Cosh[Ln[2]]; Cosh[1+i] |
Tanh[z] | hyperbolic tangent | Tanh[Ln[2]]; Tanh[1+i] |
Sech[z] | hyperbolic secant | Sech[1]; Sech[1+i] |
Cosech[z] | hyperbolic cosecant | Cosech[1]; Cosech[1+i] |
Cotanh[z] | hyperbolic cotangent | Cotanh[PI/4]; Cotanh[1+i] |
ArcSinh[z] | hyperbolic arcsine | ArcSinh[1]; ArcSinh[1+i] |
ArcCosh[z] | hyperbolic arccosine | ArcCosh[2]; ArcCosh[1+i] |
ArcTanh[z] | hyperbolic arctangent | ArcTanh[1]; ArcTanh[1+i] |
Gamma[z] | Euler's gamma | Gamma[11]==10!; Gamma[1+i] |
Zeta[x] | Riemann's Zeta | Zeta[-2] |
EllipticK[x] | complete elliptic integral of the first kind | EllipticK[1/2] |
EllipticE[x] | complete elliptic integral of the second kind | EllipticE[1/2] |
Gauss[x] | normalized gaussian (mean 0) | Gauss[1] |
Erf[x] | Error function | Erf[1] |
These functions can be directly integrated, graphed or tabulated.
Example:
Graph[x,Sin[x],0,2PI] Graph[x,Erf[x],-2,2,0.1] Table[x,Sqrt[x],0,4] List[x,Cosh[x],-1,1,0.1]
You can also call the following functions with real arguments.
function | result | example |
---|---|---|
DBinomiale[x,n,k] | distribuzione binomiale con probabilità x (0 ≤ x ≤ 1) | DBinomiale[0.3,10,4] |
EllipticL[e,a] | calculate the length of the ellipse with eccentricity 0<e<1 and major semiaxis a | EllipticL[1/2,1] |
LegendreP[n,x] | Legendre function of the first kind | LegendreP[2,1.5]; LegendreP[1/2,1.5] |
LegendreQ[n,x] | Legendre function of the second kind | LegendreQ[2,1.5]; LegendreQ[1/2,1.5] |
ChebyshevT[n,x] | Chebyshev's polynomial of the first kind | ChebyshevT[2,1.5] |
ChebyshevU[n,x] | Chebyshev's polynomial of the second kind | ChebyshevU[2,1.5] |
Gauss[x,σ] | gaussian with standard deviation σ and mean 0 | Gauss[1,1/2] |
Gauss[x,σ,μ] | gaussian with standard deviation σ e mean μ | Gauss[2,1,0.5] |
If[boolean,then,else] | If boolean is true , gives then, else gives else |
f[x]:= If[x>0,1,-1] |
The graphs of these functions cannot be directly produced. To get their graphs, you must declare a function giving it your identifier and writing one or more of the upper names in the second term of the declaration.
Example:
lp2[n]:=LegendreP[n,2]; Table[n,lp2[n],0,10,1]
There are also the following operators on real numbers.
operator | result | example |
---|---|---|
F[x] | if x is rational shows x as a fraction; otherwise produces the best rational approximation of x with the current precision. | F[Sin[PI/6];Sin[PI/6]] |
ToContinued[x] | gives the sequence of the terms of the expansion of the absolute value of f in continued fraction. | ToContinued[79/122] |
DegRad[x] | from decimal degrees to radians | DegRad[60] |
RadDeg[x] | from radians to decimal degrees | RadDeg[PI/3] |
DecDms[x] | from decimal degrees to degrees-minutes-seconds | Dms[RadDeg[1]] |
DmsDec[x] | from sexagesimal to decimal | DmsDec[DecDms[RadDeg[1]]] |
The following operators act on list of real numbers.
operator | result | example |
---|---|---|
Mean[vector] | arithmetic mean | Mean[PI,E,Sqrt[2]] |
SSDev[vector] | sample standard deviation | SSDev[PI,E,Sqrt[2]] |
PSDev[vector] | population standard deviation | PSDev[PI,E,Sqrt[2]] |
The list can be represented by a previously declared constant.
Example:
data = 12,14,13,15,11,12,12,14 Mean[data]
The following operator act on a rational numbers.
operator | result | example |
---|---|---|
Num[f] | the numerator of the fraction f | Num[Bernoulli[10]] |
Den[f] | the denominator of the fraction f | Den[Bernoulli[10]] |
N | from fraction to decimal or from repeating to decimal | N[2/3]; N[1.2[3]] |
Egyptian[r] | a fraction as sum of distinct unit fractions, said egyptian fractions | Egyptian[3/7] |
ToContinued[f] | gives the sequence of the terms of the expansion of the absolute value of f in continued fraction. | ToContinued[79/122] |
FromContinued[a_{0},a_{1},a_{2},...a_{n}] | generates the fraction corresponding to the sequence of the given coefficients. | FromContinued[0,1,1,1,5,7] |
The following operators act on one or more natural numbers.
operator | result | example |
---|---|---|
Gcd[list] | greatest common divisor | Gcd[123456,234567,345678] |
Lcm[list] | least common multiple | Lcm[123,234,345] |
PrimeQ[n] | true or false if the argument is prime or not | PrimeQ[1234567] |
PrimeF[n] | prime factor decomposition | PrimeF[1234567] |
Prime[n] | n-th prime number | Prime[12] |
Binomial[n,k] | binomial coefficient | Binomial[100,37]; Binomial[-1/2,3] |
BinomialD[p,n,k] | binomial distribution | BinomialD[0.3,10,4] |
Partition[n] | evaluations of the partition functiona of a natural number | Partition[100] |
Base[n,β] | from base 10 to the base given by the second argument | Base[1234,16] |
Fibonacci[n] | Fibonacci's sequence n-th number | Fibonacci[1234] |
Padovan[n] | Padovan's sequence n-th number | Padovan[1234] |
Perrin[n] | Perrin's sequence n-th number | Perrin[1234] |
Bernoulli[n] | Bernoulli's n-th number | Bernoulli[13] |
Euler[n] | Euler's n-th number | Euler[14] |
Bell[n] | Bell's sequence n-th number | Bell[12]; Table[n,Bell[n],0,50,1] |
DFact[n] | double factorial | DFact[14] |
Collatz[n] | Collatz's sequence | Collatz[27] |
Triples[min,max] | Pythagorean triples formed by numbers between min and max | Triples[3,300] |
Hn[n] | harmonic: gives the sum of the reciprocal of the natural numbers from 1 to n | Hn[10]-Hn[9] |
Stirling2[n,k] | Stirling's number of the second kind | Stirling2[100,37] |
Binomial
can compute also pairs of real or complex numbers.
The following operators act on one o more previously declared functions. The function identifier or a list of such identifiers must be the first argument. The second and the third argument give the analyzed range.
operator | result | example |
---|---|---|
Derive[x,f[x],x_{0}] | approximate calculation of the derivative of a real function at a point in its domain | Derive[x,Sin[x],0] |
DeriveL[x,f[x],x_{0}] | approximate calculation of the left derivative of a real function at a point in its domain | DeriveL[x,Abs[Sin[x]],0] |
DeriveR[x,f[x],x_{0}] | approximate calculation of the right derivative of a real function at a point in its domain | DeriveR[x,Abs[Sin[x]],0] |
Integrate[x,f[x],x_{1},x_{2}] | approximate calculation of the integral of a function in an interval of his domain | Integrate[x,Sin[x],0,PI/2] |
Table[x,f[x],x_{1},x_{2}] | gives the table of a function in the given range | Table[x,f[x],0,2PI] |
Table[x,f[x],x_{1},x_{2},dx] | gives the table of a function in the given range with given increment | Table[x,Sin[x],0,2PI,PI/6] |
List[x,f[x],x_{1},x_{2}] | same as Table but in text mode | List[x,Sin[x],0,2PI,PI/6] |
Values[x,f[x],x_{1},x_{2}] | gives the set of the values y of a function in the given range | Values[x,f[x],0,2PI] |
Values[x,f[x],x_{1},x_{2},dx] | gives the set of the values y of a function in the given range with given increment | Values[x,Sin[x],0,2PI,PI/6] |
Zeroes[x,f[x],x_{1},x_{2}] | gives the approximations of the zeroes in the given range | Zeroes[x,Sin[2x],-5,5] |
Analysis[x,f[x],x_{1},x_{2}] | finds the approximations to the most important points of a graph of a function in the given range | Analysis[x,f[x],-5,5] |
The following operators allow to get graphs of real functions of one real variable or some geometric plane figures.
operator | result | example |
---|---|---|
PlotRangeX[x_{1},x_{2}] | sets the lower and the upper bounds of the abscissas of the points of a graph; by default [-10,10] | PlotRangeX[-20,20] |
PlotRangeY[y_{1},y_{2}] | sets the lower and the upper bounds of the ordinates of the points of a graph; by default [-10,10] | PlotRangeY[-20,20] |
Graph[x,f[x],x_{1},x_{2}] | draws the graph of a function in a given interval using a fixed number of values of the argument equally spaced | Graph[x,Sqr[Sin[x]],0,2PI] |
Graph[x,f[x],x_{1},x_{2},dx] | draws the graph of a function in a given interval with fixed increment of the argument | Graph[x,x^2-1,-2,2,0.1] |
Graph[x,{f[x],g[x]},x_{1},x_{2}] | draws of the graph of two or more functions in a given interval using a fixed number of values of the argument equally spaced | Graph[x,{Sin[x],Cos[x]},0,2PI] |
Graph[x,{f[x],g[x]},x_{1},x_{2},dx] | draws of the graph of two or more functions in a given interval with fixed increment of the argument | Grafico[x,{Sin[x],Cos[x]},0,2PI,0.1] |
Istogramma[titolo,lista] | disegno dell'istogramma con titolo di una lista | t={12,13,14,12,10,8};Istogramma["temperature",t]] |
Segment | defines a segment given the coordinates of its ends | s=Segment[(-1,-1),(1,1)] |
Circ | defines a circle given its center and its radius | c=Circ[(0,0),1] |
Ellipse | defines an ellipse given its eccentricity and its semi-major axis | el=Ellipse[(0,0),3,1] |
Polygon | defines a regular polygon given its centre, its circumscribed radius and its number of sides | hepta=Polygon[(0,0),1,7] |
Polygonal | defines a sequence of consecutive segments given the coordinates of their ends | para=List[Sqr,-1,1]; poly= Polygonal[para]; Draw[poly] |
Draw | draws one or more figures generated by previous operators | c=Circ[(0,0),1]; Draw[c]; para=List[Sqr,-1,1]; poly= Polygonal[para]; Draw[{c,poly}] |
Translate | translates the figures generated by previous operators | q=Polygon[(0,0),1,4]; tq=Translate[q,(-1,2)]; Draw[tq] |
Rotate | rotates the figures generated by previous operators | q=Polygon[(0,0),1,4]; rq=Rotate[q,30°]; Draw[rq] |
The following operators act on one or more numerical vectors.
operator | result | example |
---|---|---|
Norm[v] | the length of the vector | Norm[v] |
PolarAngle[v] | gets the polar angle of a real two-dimensional vector | PolarAngle[{1/2,Sqrt[3]/2}] |
UnitVector[v] | the unit vector with the same polar angle | UnitVector[v] |
The following operators act on square matrices.
operator | result | example |
---|---|---|
Det[m] | square matrix determinant | Det[matr] |
Transpose[m] | evaluation of the transposed matrix | Transpose[matr] |
Inverse[m] | evaluation of the inverse matrix | Inverse[matr] |
Conjugate[m] | evaluation of the conjugate matrix | Conjugate[matr] |
Adjoint[m] | evaluation of the adjoint matrix | Adjoint[matr] |
LinearSolve[m,v] | calculate the solution of a system of linear equations | LinearSolve[{{1,2},{0,1}},{3,4}] |
EigenValues[m] | eigenvalues of a square matrix | EigenValues[{{1,2},{2,i}}] |
EigenVectors[m] | eigenvectors of a square matrix | EigenVectors[{{1,2},{2,i}}] |
Using the standard operation signs one can make additions, multiplications, subtractions, divisions, powers to integer exponent of matrices.
Example.
m1={1,2,3}{2,3,4}{3,4,1}
m1^2
m2={5,2,1}{1,-1,3}{-1/2,0,1}
m1*m2
m1[0]+m1[1]
m1[0][2]^2
The following operators act on the content of lists.
operator | result | example |
---|---|---|
Append[l,o] | given a list identifier l and an item o, puts o at the end of l | Append[l,o] |
Append[l,l1] | given two list identifiers l and l1, appends to l all the items of l1 | Append[l,l1] |
Insert[l,o,ix] | given a list identifier l, the item o and an index ix, inserts o in the position ix of l | Insert[l,o,ix] |
Insert[l,l1,ix] | given two list identifiers l and l1 and an index ix, inserts all the items of l2 in l1 beginning from the position ix | Insert[l,l1,ix] |
Remove[l,ix] | given a list identifier l and an index ix, removes from l the item at the position ix | Remove[l,ix] |
Remove[l,ix_{1},ix_{2}] | given a list identifier l and two indexes ix1 e ix1, removes from l all the items from the position ix1 to the position ix2 | Remove[l,ix1,ix2] |
Set[l,o,ix] | given a list l, an item o and an index ix, substitutes with o the item at the position ix | Set[l,o,ix] |
ASort[l] | given a list l containing numeric values or strings, sorts l in ascending order ie from the smallest to the largest | ASort[1,-4,PI,R,11/3,2e-1,2^5] |
DSort[l] | given a list l containing numeric values or strings, sorts l in descending order ie from largest to smallest | DSort[1,-4,PI,R,11/3,2e-1,2^5] |
Frequencies[l] | Given a list l containing numeric values, groups the values in ascending order counting how many times they appear in the list. | r[x]:=Int[Random[10]]; Frequencies[Values[r,1,100,1]] |
The following operators generate outputs of financial mathematics.
operator | result | example |
---|---|---|
Percent | given a loan and the interest rate, evaluates the interest | Percent[100000,4.85] |
Payment | given the loan amount, the annual interest rate, the term and the number of annual payments, evaluates the amount of the periodic payment | Payment[100000,4,10,12] |
Interest | given the loan amount, the constant periodic payment, the term and the number of annual payments, evaluates the effective annual interest rate | Interest[100000,1250,10,12] |
Amortization | given the loan amount, the annual interest rate, the term and the number of annual constant payments, prints the amortization table | Amortization[100000,4,10,12] |
The following operators rewrite the input strings and the output values for further calculations.
operator | result | example |
---|---|---|
In | rewrites the n-th input string | In[4] |
Out | rewrites the n-th output value | Out[4] |
Clear | cancels a previous assignment | a=1; Clear["a"] |
The following operators give calendarial informations.
operator | result | example |
---|---|---|
Today | today's date | Today |
Now | the instant time | Now |
DayOfWeek | the day of the week from year, month, day of the month | DayOfWeek[1900,1,1] |
Easter | calculates the Easter date of the given year | Easter[2007] |
Trigonometry
operator | result | example |
---|---|---|
Triangle[a,b,c,α,β,γ] | triangle solution | Triangle[1,1,0,PI/6,0,0] |
DistanceKm[la1,lo1,la2,lo2] | distance between two points on the Earth's surface (kilometers) | DistanceKm[0°,0°,0°,1'] |
DistanceNm[la1,lo1,la2,lo2] | distance between two points on the Earth's surface (nautical miles) | DistanceNm[44°13',0°,44°14',0°] |
The operator Triangle
allows you to solve a triangle given three of its
elements; at least one of them must be a side; angles are input as radians; unknown elements are input as 0
.
The last two functions require four arguments expressed by sexagesimal numbers in the following order:
SOUTH latitudes and WEST longitudes require a minus sign.
Distances are calculated as the crow flies along a path on the surface of a theoretical geoid using the Vincenty's method, as applied in a page of Chris Veness.
Mathematical expressions
The mathematical expressions must be inputted by typewritten strings, using the keys of a standard keyboard. They can contain numbers given immediately or represented by identifiers of constants, operations signs, built-in functions or user declared functions, parentheses eventually nested and well balanced.
Examples.
PI*8^2
(2+3)/4
(Sin[PI/3])^2
f1[2]+f2[Ln[2]]
((10!/9!)+2)/5
Grouping marks
The grouping marks are:
Storage of a constant value
To store a constant value one must write an arbitrary identifier followed
by =
and by the value.
Example.
a = 12
b = 1/2
halfln2 = Ln[2]/2
data = {2,2,3,3,4,4,4,4,5,5,5,4,4,3,2,1}
matrix1 = {{2,2,3,3},{4,4,4,4},{5,5,5,4},{4,3,2,1}}
(but matrix1 = {2,2,3,3}{4,4,4,4}{5,5,5,4}{4,3,2,1}
works fine)Identifiers are case sensitive.
Identifiers can be reassigned.
Declaration of a function
To declare a real function of one or more variables,
one must write an arbitrary identifier followed by brackets enclosing one or more variables.
The brackets must be followed by :=
(Pascal like) and by
the expression of the function in terms of these variables.
Examples.
f[x] := x^2-1
f1[x] := Sin[2x]+2Cos[x]
f2[x,y] := Sqrt[x^2+y^2]
Parametric functions can be declared as functions of a single variable expressed by a list of two or more expressions. The list must contain only names of functions
Example.
f[x] := {Cos[x],Sin[x]}
g1[x] := x^2
g2[x] := x^3
g[x] := {g1[x],g2[x]}
Declared real functions of one real variable may be analyzed by the following operators.
Table
applied to
four arguments: the variable, the function identifier and the bounds of the range analyzed.
Zeroes
applied to
three arguments: the function identifier and the bounds of the range analyzed.
This operator may be successful only if the function is continue and its signs at the bounds of the
range are opposite.Analysis
applied to three arguments: the function identifier and the bounds of the range analyzed.Graph
applied to three arguments: the function identifier
(or the list of identifiers) and the bounds of the analyzed range .
Tables of functions
Real functions of real variable may be tabulated using the operator
Table
with almost four parameter: the variable, the function, the lower and the upper bounds of
the interval. An optional fifth parameter may set the increment of the variable between two successive values.
If there isn't a fifth parameter, the increment is calculated by dividing the interval by the value of the field
n. of points
.
Examples.
Table[x,Sin[x],0,2PI]
Table[x,Sin[x],0,2PI,PI/20]
qsin[x]:=Sin[x]^2; Table[x,qsin[x],-2PI,2PI,PI/20]
Table[x,(x^2-1)/(x^2+1),-4,4]
It is possible to tabulate two or more functions by inserting their names in a list delimited by braces.
Examples.
Table[x,{Sin[x],Cos[x]},0,2PI]
f1[x] := x^2-1; f2[x] := 1-x^2; Table[x,{f1[x],f2[x]},-2,2,0.1]
Graphs of functions
Functions can be plotted by using the operator Graph
with almost four arguments: the variable, the name of the function, the beginning and the end of the analyzed interval.
Example.
Graph[x,Sin[x],-2PI,2PI]
You can get in a single plane the graphs of two or more functions, by including their names in a list delimited by curly braces.
Example.
Graph[x,{Sin[x],Cos[x]},-2PI,2PI]
It is possible to get the graph of a function defined by the user.
Example.
sinsq[x]:=Sin[x]^2; Graph[x,sinsq[x],0,2PI]
It is possible to get the graph of a parametric function of two real variables.
For example, after the declaration of the function f[x]:={Cos[x],Sin[x]}
,
the statement Graph[x,f[x],0,2PI]
makes a circle of radius 1.
Examples.
Given the functions f1[x] := Cos[x+PI/4]
and f2[x] := Cos[x-PI/4]
:
we can graph them separately;
Graph[x,f1[x],-2PI,2PI]
Graph[x,f2[2],-2PI,2PI]
we can graph them together;
Graph[x,{f1[x],f2[x]},-2PI,2PI]
we can define a parametric function
f1f2[x] := {f1,f2}
and get its graph
Graph[f1f2,-PI,PI]
Some other examples.
Graph[x,(x^2-1)/(x^2+1),-4,4]
Graph[x,{1,(x^2-1)/(x^2+1)},-4,4]
As you can see in the images of examples, by setting or clearing the check boxes axes
,
grid
and measures
,
you can change the view, adding or removing the axes, the grid background and the values of abscissas and ordinates.
The red buttons allow you to modify the graph enlarging or reducing it or by moving it leftward, rightward, upward and downward.
The graphs can be dragged within their window. The size of the window can be adapted by dragging its borders.
The save
button (the rightmost one of the top row) starts a procedure that allows you to insert
the generated graph into an Html
page that can be downloaded to your computer.
If you click this button:
gif
or png
or jpg
;Html
page that will be produced if you click the button download output
of the applet;In a similar way, you can save the tables produced by the operator Table
.
In this case, the save
button at the bottom of the table, starts a procedure that allows you to insert
the table into an html
page that can be downloaded to your computer.
If you click this button:
html
page that will be produced if you click the button download output
of the applet;
geometric figures
You can draw some plane geometric figures, like segments, polygons, circles, ellipses, arcs of curves, in a Cartesian plane. In order to do this, you must take the following steps:
assign an identifier to the result of one of the following operators:
Segment
Polygonal
Polygon
Circ
Ellipse
Translate
Rotate
Draw
.Examples.
penta=Polygon[(0,0),1,5]; Draw[penta]
c=Circ[(0,0),1]; sq=Polygon[(0,0),1,4]; Draw[c,sq]
To obtain arcs of curves given by real valued functions, you must take the following steps:
create a list of points using the operator List
; example:
lpara=List[x,Sqr[x],-1,1,0.1]
create a drawable object using the operator Polygonal
; example:
para=Polygonal[lpara]
Now this last object can be an argument for the operator Draw
.
Example.
lpara=List[x,Sqr[x],-1,1,0.1]; para=Polygonal[lpara]; c=Circ[(0,0),1]; Draw[para,c]
The description of a drawing can be translated or rotated
tri=Polygon[(0,0),1,3]; transl=Translate[tri,(2,1)]; rot=Rotate[tri,45°]; Draw[tri,transl,rot]
Histograms
You can represent two-dimensional histograms using the Histogram
operator with argument given
by a list of pairs {number, number}
or {string, number}
.
Optionally the list may be preceded by a string with the title.
Example.
b[k] := Binomial[10,k]; Histogram["binomial coefficients",List[k,b[k],0,10,1]]
tlist=("London",20),("Oslo",15),("Madrid",22);Histogram["temperatures",tlist]
last revision: July 2015