Prepared by Guoqi Qian 1 MAST20006 Probability for Statistics / MAST90057 Elements of Probability Maple Reference Sheet • All commands and constants must be typed in the case (UPPER or lower) that is indicated. • Description of a topic can be displayed by typing help(topic). Arithmetic Operations + Addition ! subtraction * Multiplication / division ^ exponentiation ! factorial Some Mathematical Constants Pi " exp(1) e -infinity !# infinity # Mathematical Functions and Expressions f:= expression; labels the expression as f g:=unapply(f,x); define g as a function of variable x with expression f h:=unapply(f,x,y); define h as a function of variables x and y with expression f binomial(n,r); combinatorial number of n choosing r a*(b+2*a)+c^2+(a+b)/c; c ba caba + +++ 2)2( exp(x) x e log(x), ln(x) )ln(),log( xx abs(x) || x min(a1,a2,…), max(a1,a2,…) minimum/maximum of a sequence a1, a2, … sin(x),cos(x),tan(x),csc(x),… trigonometric functions arcsin(x),arccos(x),arctan(x)… inverse trigonometric functions Some useful commands % refer to the immediate past display assign(a,b); or assign(a=b); assign name or function a an expression b assume(a>0, b<=2); assume a>0 and b$2 diff(f,x); differentiate f w.r.t x diff(f,x$k); compute the kth derivative of f w.r.t. x eval(f,x=a); evaluate the expression f at x=a evalf(f); numerical evaluation of expression f factor(f); factorize a multivariate polynomial f int(f,x=a..b); ! b a fdx int(int(f, x=a..b), y=c..d); ! ! d c b a dxdyf limit(f,x=a); f ax! lim piecewise(cond_1,f_1,cond_2,f_2, …,cond_n,f_n, f_otherwise); create a piecewise-continuous function Prepared by Guoqi Qian 2 plot(f,x=a..b); plot the expression f against x on (a,b) simplify(f); apply simplification rules to f solve(f,x); fsolve(f,x); Solve the equation f=0 for x. subs(x=a,f); substitute a for x in the expression f sum(f,k=m..n); ! = n mk f sum(sum(f,k=m..n),j=i..l); ! != = l ij n mk f taylor(f,x=a,n); computes a truncated Taylor series (up to the nth order term) of f, expanded about x=a unassign(‘a1’,‘a2’,…); remove the values of a1, a2, etc. with(Statistics): call Statistics package Random variables and probability distributions Discrete distributions: Binomial(n,p), Geometric(p), Hypergeometric(N1+N2, N1, n), NegativeBinomial(r,p), Poisson(lambda). Continuous distributions: Uniform(a,b), Exponential(theta), Gamma(theta,alpha), ChiSquare(df), Normal(mu,sigma). X:=RandomVariable(Distribution(PDF=f)); create a random variable X with the pdf specified by a separately created function f. X:=RandomVariable(DistributionName(parameters)); e.g. X:=RandomVariable(Uniform(a,b)); create a random variable X having a Maple-built-in distribution specified by its name and parameters. ProbabilityFunction(X,x); pmf of a discrete random variable X, )( xXP == PDF(X,x); pdf of a continuous random variable X, )(xf X= CDF(X,x); cdf of a continuous random variable X, )(xFX= MGF(X,t); mgf of a random variable X, ][)( tXeEtM == Probability({X>a, X<=b}) ),( bXaXP !> Percentile(X, 95); Percentile(X, percent); compute the 95 th percentile of X compute the “percent” percentile of X Mean(X); )(XE Variance(X); )(Var X Moment(X,k); )( kXE A:=Sample(X,n); generate a sample of n numbers from X and save the sample into A. Histogram(A, range=a..b); plot a histogram of A DensityPlot(X,range=a..b); plot the density function of X
欢迎咨询51作业君