numerical approximation | 2*pi.n() 2*pi.n(digits=50) |
show it pretty | show(expand((x+5)^2)) |
derivative | var('x y') f(x,y) = 5*x^3*y^2 diff(f,x,y).substitute(x=-1,y=5) |
headings | # section ## subsection |
images | <img src="url or filename" width=200> |
links | <url> <a href="url">text</a> |
new line | (double space) |
italic | *text* |
bold | **text** |
strike-out | ~~text~~ |
horizontal line | --- |
color | <span style='color:green'>green text</span> |
lists |
- animals 1. zebra 2. yak - minerals 1. calcium 2. sodium |
table |
| Col1 | Col2 | Col3 | | :----------- | :------: | ------------: | | Left-aligned | Centered | Right-aligned | | blah | blah | blah | |
source code | inline `like this`, or for a block:``` int x=1 for (int i=1;i<=10;i++) x += i; printf("%d\n",x) ``` |
block quote sections | prefix with "> "
> this section will be set apart > from the surrounding material |
fraction | $\frac{ x+2 }{ x^2+1 }$ |
subscript and superscript | $x_a^{12}$ |
functions | $\sqrt{x} , \sqrt[3]{x}, \cos(x), \ln(x), \min(x), \| \cdot \|$ |
greeks | $\alpha, \beta, \pi, \sigma, \Sigma$ |
hats | $\hat{x} , \tilde{x}$ |
integral symbol | $\int , \iint , \oint$ |
misc symbols | $\neq, \leq, \times, \rightarrow, \nabla, \pm, \subset, \cdots, \exists, \forall, \heartsuit$ |
limits | $$\lim_{n \rightarrow \infty} \left( 1+\frac{1}{n} \right)^n = e$$ |
derivatives | $\frac{dy}{dx}$ $\frac{\partial y}{\partial x}$ |
matrix | $\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ |
R Statistics SoftwareWhat is R?R is a free open-source statistical software package. Think of it as a calculator on steroids. It has a command-line interface, and can serve as a programming language. It can do simulations, graphs, and analysis on data that you enter yourself, or download from the web.References
Installing RR is installed on selected lab computers, but you are strongly encouraged to install this software on your own PC.
R Quick Introduction
|
enter data | STAT-EDIT; fill in data vals in L1, and optionally frequency in L2 |
restore lost list | STAT-5-ENTER |
One variable summary | STAT-CALC, 1VarStats L1 (,L2) |
factorial | 5 [[math , prb , ! ]] |
permuation | 5 [[ math, prb, nPr ]] 2 |
combination | 5 [[ math, prb, nCr ]] 2 |
binomial for exactly x | binompdf(n, p, x) |
binomial for less than or equal to x | binomcdf(n, p, x) |
full binomial distribution | binompdf(n,p) [ -> L2 ] |
normal for x between a and b | normalcdf(a,b,mu,sigma) (use +/- E99 for infinity) |
normal distribution, given a percentile area A, find x | invnorm(A,mu,sigma) |
conf int / hyp test for proportion | STAT-TESTS-1-PropZInt/Test |
conf int / hyp test for sample mean | STAT-TESTS-TInterval/Test |
conf int / hyp test for 2-sample proportion | STAT-TESTS-2-PropZInt/Test |
conf int / hyp test for 2-sample mean | STAT-TESTS-2-SampTInt/Test |
hyp test for standard deviations | STAT-TESTS-2-SampFTest |
linear regression / correlation | enter data in L1,L2, and then STAT-TESTS-LinRegTTest |
ANOVA | enter data in L1,L2,L3,etc, and then STAT-TESTS-ANOVA(L1,L2,L3) |
chi-squared test for independence | enter contingency table in MATRIX-EDIT, then STAT-TESTS-chi^2 |
submit commands for processing | shift-enter |
define a function | f(x):=x^2; f(2); |
make a sequence | makelist([n,1/n],n,1,10); |
find a limit | limit((n+1)/n,n,inf); |
Taylor series | taylor(exp(x), x, 0, 8); |
parametric plot | plot2d ([parametric, cos(t), sin(t), [t, 0, 2*%pi], [nticks,100]]); |
parametric plot | load(draw); draw2d(parametric(cos(t),sin(t),t,0,2*%pi)); draw3d(parametric(cos(t),sin(t),t,t,0,2*%pi)); |
animated plot | load(draw); r(t):=[cos(t),sin(t)]; Tmin:0; Tmax:4*%pi; n:50; with_slider_draw( T, makelist(Tmin+i*(Tmax-Tmin)/n,i,0,n), xrange = [-2,2], yrange = [-2,2],grid=true,dimensions=[600,500], label([printf(false,"t=~8,3f",T),0,0]), parametric(r(t)[1],r(t)[2],t,0,T) , point_size=2,point_type=filled_circle,color=red, points([r(T)]) ); |
3d surface plot | load(draw); draw3d(enhanced3d=true,surface_hide=true,xu_grid=50,yv_grid=50,xlabel="x",ylabel="y", contour_levels=10,contour=base,explicit(sin(x*y),x,-2,2,y,-2,2)); |
vector valued functions |
load(eigen); load(vect); r(t):=[sin(t), cos(t), t]; define(v(t), diff(r(t),t) ); define(speed(t), sqrt(v(t).v(t)) ); define(T(t), unitvector(v(t)) ); define(a(t), diff(v(t),t) ); define(Tprime(t), diff(T(t),t) ); define(N(t), unitvector(Tprime(t)) ); define(aT(t), diff(speed(t),t)); define(aN(t), sqrt(a(t).a(t) - aT(t)^2) ); define(kurv(t), aN(t) / (v(t).v(t)) ); define(R(t), 1/kurv(t) ); define(B(t), express(T(t)~N(t)) ); float(v(1)); float(a(1)); float(aT(1)*T(1) + aN(1)*N(1)); |
Lagrange multipliers |
f(x,y):=x^2+2*y^2; g(x,y):=y-x^2+4; solns:solve( [ diff(f(x,y),x)-L*diff(g(x,y),x), diff(f(x,y),y)-L*diff(g(x,y),y), g(x,y)], [x,y,L])$ for soln in solns do ( print(soln," f=",float(ev(f(x,y),soln))) ); |
Milk-maid problem |
load(draw)$ load(mnewton)$ f(x,y):=sqrt((x+1)^2+y^2)+sqrt((x-1)^2+y^2); g(x,y):=(x^2+3*y-6)*(y-2)-3*x; x0:-2; x1:2; y0:-2; y1:4; draw2d( grid = true, color = black, point_size = 5,point_type = filled_square, points([ [-1,0], [1,0] ]), color = blue,line_width = 4, implicit(g(x,y) = 0,x,x0,x1,y,y0,y1), line_width=2, color = red, implicit(f(x,y)=2.03,x,x0,x1,y,y0,y1), color = orange, implicit(f(x,y)=2.1,x,x0,x1,y,y0,y1), color = purple, implicit(f(x,y)=2.5,x,x0,x1,y,y0,y1), color = forest_green,implicit(f(x,y)=3,x,x0,x1,y,y0,y1), color = brown, implicit(f(x,y)=3.5,x,x0,x1,y,y0,y1), color = pink, implicit(f(x,y)=4,x,x0,x1,y,y0,y1) )$ soln:mnewton([ g(x,y), diff(f(x,y),x)-L*diff(g(x,y),x), diff(f(x,y),y)-L*diff(g(x,y),y) ], [x,y,L], [1,.5,0]); ev(f(x,y),soln); |