2015年6月13日 星期六

MuPAD基本運算


使用MuPAD繪製Inverse Trigonometric Function


f1 := plot::Function2d(sin(x), x = -PI/2..PI/2, Color = RGB::Blue);
f2 := plot::Function2d(arcsin(x), x = -1..1, Color = RGB::Green)

plot(f1, f2)




f1 := plot::Function2d(cos(x), x = 0..PI, Color = RGB::Blue);
f2 := plot::Function2d(arccos(x), x = -1..1, Color = RGB::Green)

plot(f1, f2)


f1 := plot::Function2d(tan(x), x = -PI/2..PI/2, Color = RGB::Blue);
f2 := plot::Function2d(arctan(x), x = -10..10, Color = RGB::Green)

plot(f1, f2)


f1 := plot::Function2d(cot(x), x = -PI/2..PI/2, Color = RGB::Blue);
f2 := plot::Function2d(arccot(x), x = -5..5, Color = RGB::Green)

plot(f1, f2)


f1 := plot::Function2d(sec(x), x = 0..PI, Color = RGB::Blue);
f2 := plot::Function2d(arcsec(x), x = -5..5, Color = RGB::Green)

plot(f1, f2)


f1 := plot::Function2d(csc(x), x = -PI/2..PI/2, Color = RGB::Blue);
f2 := plot::Function2d(arccsc(x), x = -5..5, Color = RGB::Green)

plot(f1, f2)

MuPAD--linalg函數庫(linear algebra package)中的函數

可鍵入info(linalg)觀察在linalg(linear algebra package)函數庫中的函數; 也可以由MuPAD 的Help查詢更詳細的使用說明

[[From MuPAD Help]]

linalg::addCol – linear combination of matrix columns
linalg::addRow – linear combination of matrix rows
linalg::adjoint – Adjoint of a matrix
linalg::angle – The angle between two vectors
linalg::basis – basis for a vector space
linalg::charmat – characteristic matrix
linalg::charpoly – characteristic polynomial of a matrix
linalg::col – extract columns of a matrix
linalg::companion – Companion matrix of a univariate polynomial
linalg::concatMatrix – join matrices horizontally
linalg::cond – Condition number of a matrix
linalg::crossProduct – cross product of three-dimensional vectors
linalg::curl – curl of a vector field
linalg::delCol – delete matrix columns
linalg::delRow – delete matrix rows
linalg::det – determinant of a matrix
linalg::divergence – divergence of a vector field
linalg::eigenvalues – eigenvalues of a matrix
linalg::eigenvectors – eigenvectors of a matrix
linalg::expr2Matrix – construct a matrix from equations
linalg::factorCholesky – the Cholesky decomposition of a matrix
linalg::factorLU – LU-decomposition of a matrix
linalg::factorQR – QR-decomposition of a matrix
linalg::frobeniusForm – Frobenius form of a matrix
linalg::gaussElim – Gaussian elimination
linalg::gaussJordan – Gauss-Jordan elimination
linalg::gradient, linalg::grad – vector gradient
linalg::hermiteForm – Hermite normal form of a matrix
linalg::hessenberg – Hessenberg matrix
linalg::hessian – Hessian matrix of a scalar function
linalg::hilbert – Hilbert matrix
linalg::htranspose – Hermitean transpose of a matrix
linalg::intBasis – basis for the intersection of vector spaces
linalg::inverseLU – computing the inverse of a matrix using LU-decomposition
linalg::invhilbert – inverse of a Hilbert matrix
linalg::invpascal – inverse of a Pascal matrix
linalg::isHermitean – checks whether a matrix is Hermitean
linalg::isPosDef – test a matrix for positive definiteness
linalg::isUnitary – test whether a matrix is unitary
linalg::jacobian – Jacobian matrix of a vector function
linalg::jordanForm – Jordan normal form of a matrix
linalg::kroneckerProduct – Kronecker product of matrices
linalg::laplacian – the Laplacian
linalg::matdim – dimension of a matrix
linalg::matlinsolve – solving systems of linear equations
linalg::matlinsolveLU – solving the linear system given by an LU decomposition
linalg::minpoly – minimal polynomial of a matrix
linalg::multCol – multiply columns with a scalar
linalg::multRow – multiply rows with a scalar
linalg::ncols – number of columns of a matrix
linalg::nonZeros – number of non-zero elements of a matrix
linalg::normalize – normalize a vector
linalg::nrows – number of rows of a matrix
linalg::nullspace – basis for the null space of a matrix
linalg::ogCoordTab – table of orthogonal coordinate transformations
linalg::orthog – orthogonalization of vectors
linalg::pascal – Pascal matrix
linalg::permanent – permanent of a matrix
linalg::potential – the (scalar) potential of a gradient field
linalg::pseudoInverse – Moore-Penrose inverse of a matrix
linalg::randomMatrix – generate a random matrix
linalg::rank – rank of a matrix
linalg::row – extract rows of a matrix
linalg::scalarProduct – scalar product of vectors
linalg::setCol – change a column of a matrix
linalg::setRow – change a row of a matrix
linalg::smithForm – Smith canonical form of a matrix
linalg::sqrtMatrix – square root of a matrix
linalg::stackMatrix – join matrices vertically
linalg::submatrix – extract a submatrix or a subvector from a matrix or a vector, respectively
linalg::substitute – replace a part of a matrix by another matrix
linalg::sumBasis – basis for the sum of vector spaces
linalg::swapCol – swap two columns in a matrix
linalg::swapRow – swap two rows in a matrix
linalg::sylvester – Sylvester matrix of two polynomials
linalg::tr – trace of a matrix
linalg::toeplitz – Toeplitz matrix
linalg::toeplitzSolve – solve a linear Toeplitz system
linalg::transpose – transpose of a matrix
linalg::vandermonde, linalg::invvandermonde – Vandermonde matrices and their inverses
linalg::vandermondeSolve – solve a linear Vandermonde system
linalg::vecdim – number of components of a vector
linalg::vectorOf – type specifier for vectors
linalg::vectorPotential – vector potential of a three-dimensional vector field
linalg::wiedemann – solving linear systems by Wiedemann's algorithm

MuPAD--linopt函數庫(linear optimization package)中的函數

可鍵入info(linopt)觀察在linopt(linear optimization package, 線性規劃)函數庫中的函數; 也可以由MuPAD 的Help查詢更詳細的使用說明

[[From MuPAD Help]]

linopt::corners – return the feasible corners of a linear program
linopt::maximize – maximize a linear or mixed-integer program
linopt::minimize – minimize a linear or mixed-integer program
linopt::plot_data – plot the feasible region of a linear program
linopt::Transparent – return the ordinary simplex tableau of a linear program
linopt::Transparent::autostep – perform the next simplex step
linopt::Transparent::clean_basis – delete all slack variables of the first phase from the basis
linopt::Transparent::convert – transform the given tableau into a structure printable on screen
linopt::Transparent::dual_prices – get the dual solution belonging to the given tableau
linopt::Transparent::phaseI_tableau – start an ordinary phase one of a 2-phase simplex algorithm
linopt::Transparent::phaseII_tableau – start phase two of a 2-phase simplex algorithm
linopt::Transparent::result – get the basic feasible solution belonging to the given simplex tableau
linopt::Transparent::simplex – finish the current phase of the 2-phase simplex algorithm
linopt::Transparent::suggest – suggest the next step in the simplex algorithm
linopt::Transparent::userstep – perform a user defined simplex step

MuPAD--numeric函數庫中的函數

可鍵入info(numeric)觀察在numeric函數庫中的函數; 也可以由MuPAD 的Help查詢更詳細的使用說明

[[From MuPAD Help]]

numeric::butcher – Butcher parameters of Runge-Kutta schemes
numeric::complexRound – round a complex number towards the real or imaginary axis
numeric::cubicSpline – interpolation by cubic splines
numeric::cubicSpline2d – interpolation by 2-dimensional bi-cubic splines
numeric::det – determinant of a matrix
numeric::eigenvalues – numerical eigenvalues of a matrix
numeric::eigenvectors – numerical eigenvalues and eigenvectors of a matrix
numeric::expMatrix – the exponential of a matrix
numeric::factorCholesky – Cholesky factorization of a matrix
numeric::factorLU – LU factorization of a matrix
numeric::factorQR – QR factorization of a matrix
numeric::fft, numeric::invfft – Fast Fourier Transform
numeric::fMatrix – functional calculus for numerical square matrices
numeric::fsolve – search for a numerical root of a system of equations
numeric::gaussAGM – Gauss' arithmetic geometric mean
numeric::gldata – weights and abscissae of Gauss-Legendre quadrature
numeric::gtdata – weights and abscissae of Gauss-Tschebyscheff quadrature
numeric::indets – search for indeterminates
numeric::int – numerical integration (the float attribute of int)
numeric::inverse – the inverse of a matrix
numeric::leastSquares – least squares solution of linear equations
numeric::linsolve – solve a system of linear equations
numeric::matlinsolve – solve a linear matrix equation
numeric::ncdata – weights and abscissae of Newton-Cotes quadrature
numeric::odesolve – numerical solution of an ordinary differential equation
numeric::odesolve2 – numerical solution of an ordinary differential equation 
numeric::odesolveGeometric – numerical solution of an ordinary differential equation on a homogeneous manifold
numeric::ode2vectorfield – convert an ode system to vectorfield notation
numeric::polyrootbound – a bound for the roots of a univariate polynomial
numeric::polyroots – numerical roots of a univariate polynomial
numeric::polysysroots – numerical roots of a system of polynomial equations
numeric::product – numerical approximation of products
numeric::quadrature – numerical integration (“quadrature”)
numeric::rank – numerical estimate of the rank of a matrix
numeric::rationalize – approximate a floating point number by a rational number
numeric::realroot – numerical search for a real root of a real univariate function
numeric::realroots – isolate intervals containing real roots of a univariate function
numeric::rotationMatrix – the orthogonal matrix of the rotation about an axis
numeric::singularvalues – numerical singular values of a matrix
numeric::singularvectors, numeric::svd – numerical singular value decomposition of a matrix
numeric::solve – numerical solution of equations (the float attribute of solve)
numeric::sort – sort a numerical list
numeric::spectralradius, numeric::spectralRadius – the spectral radius of a matrix
numeric::sum – numerical approximation of sums (the float attribute of sum) 

使用MuPAD繪製Trigonometric Function

>> mupad

plot::easy(sin(x), [PI/2,1])

plot(sin(x), [PI/2,1], #x=PI/2, #y=0.5)




f1 := plot::Function2d(sin(x), x = 0..2*PI, Color = RGB::Blue);
f2 := plot::Function2d(cos(x), x = 0..2*PI, Color = RGB::Green)

plot(f1, f2)


f1 := plot::Function2d(tan(x), x = -PI..PI, Color = RGB::Blue);


plot(f1)


f1 := plot::Function2d(cot(x), x = -PI..PI, Color = RGB::Blue);

plot(f1)


f1 := plot::Function2d(sec(x), x = -PI..PI, Color = RGB::Black);

plot(f1)

f1 := plot::Function2d(csc(x), x = -PI..PI, Color = RGB::Yellow);

plot(f1)




2015年6月4日 星期四

Plot -- Inverse Trigonometric Function

%========================================
% sin^-1(x)
%========================================
close all
figure,
x=-pi:0.1:pi;
y=sin(x);
plot(x,y,'--b')
x=[-pi/2:0.1:pi/2 pi/2];
y=sin(x);
hold on
plot(x,y,'b','LineWidth',3)
hold off
axis([-3.5 3.5 -1.5 1.5])
line( [0 0], [-1.5 1.5], 'color', 'm');
line( [-3.5 3.5], [0 0], 'color', 'm');
line( [-pi/2 -pi/2], [-1.05 0.05], 'color', 'r');
line( [pi/2 pi/2], [-0.05 1.05], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{14}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{14}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(-{\it\pi} /2,-1)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm({\it\pi} /2,1)')
gtext('\fontname{Times New Roman}\fontsize{14}{\itf}\rm({\itx}) = sin\itx')

x=-pi:0.1:pi;
y=sin(x);
figure, plot(x,y,'--b')
x=[-pi/2:0.1:pi/2 pi/2];
y=sin(x);
hold on
plot(x,y,'b','LineWidth',3)
x=-1:0.1:1;
y=asin(x);
plot(x,y,'g','LineWidth',3)
x=-2:0.1:2;
y=x;
plot(x,y,'--c')
hold off
axis([-2 2 -2 2])
line( [0 0], [-2 2], 'color', 'm');
line( [-2 2], [0 0], 'color', 'm');
line( [-pi/2 -pi/2], [-1.05 0.05], 'color', 'r');
line( [-1 -1], [-pi/2-0.05 0.05], 'color', 'b');
line( [pi/2 pi/2], [-0.05 1.05], 'color', 'r');
line( [1 1], [-0.05 pi/2+0.05], 'color', 'b');
line( [-1.05 0.05], [-pi/2 -pi/2], 'color', 'b');
line( [-0.05 1.05], [pi/2 pi/2], 'color', 'b');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(-{\it\pi} /2,-1)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm({\it\pi} /2,1)')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = sin\itx')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(-1,-{\it\pi} /2)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(1,{\it\pi} /2)')
gtext('-1')
gtext('1')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = sin^{-1}\itx')



%========================================
% cos^-1(x)
%========================================
close all
figure,
x=-pi/2:0.1:3*pi/2;
y=cos(x);
plot(x,y,'--b')
x=[0:0.1:pi pi];
y=cos(x);
hold on
plot(x,y,'b','LineWidth',3)
hold off
axis([-0.5 3.5 -1.5 1.5])
line( [0 0], [-1.5 1.5], 'color', 'm');
line( [-3.5 3.5], [0 0], 'color', 'm');
line( [-0.5 0.05], [1 1], 'color', 'r');
line( [pi pi], [-1.05 0.05], 'color', 'r');
line( [pi/2 pi/2], [-0.05 0.05], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('(0,1)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm({\it\pi},-1)')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cos\itx')
x=-2:0.1:3*pi/2;
y=cos(x);
figure, plot(x,y,'--b')
x=[0:0.1:pi pi];
y=cos(x);
hold on
plot(x,y,'b','LineWidth',3)
x=-1:0.1:1;
y=acos(x);
plot(x,y,'g','LineWidth',3)
x=-2:0.1:4;
y=x;
plot(x,y,'--c')
hold off
axis([-2 4 -2 4])
line( [0 0], [-2 4], 'color', 'm');
line( [-2 4], [0 0], 'color', 'm');
line( [-2 0.1], [1 1], 'color', 'r');
line( [pi pi], [-1.1 0.1], 'color', 'r');
line( [pi/2 pi/2], [-0.1 0.1], 'color', 'r');
line( [-0.1 0.1], [pi/2 pi/2], 'color', 'r');
line( [-2 -0.9], [pi pi], 'color', 'b');
line( [-1 -1], [-0.1 pi+0.1], 'color', 'b');
line( [1 1], [-0.1 0.1], 'color', 'b');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('-1')
gtext('1')
gtext('\fontname{Times New Roman}\fontsize{10}\rm({\it\pi} /2,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{10}\rm({\it\pi},-1)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(-1,{\it\pi})')
gtext('\fontname{Times New Roman}\fontsize{10}\rm(0,{\it\pi} /2)')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cos\itx')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cos^{-1}\itx')



%========================================
% tan^-1(x)
%========================================
close all
figure,
x=[-pi/2+0.05:0.1:pi/2];
y=tan(x);
plot(x,y,'b','LineWidth',3)
axis([-10 10 -10 10])
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [-pi/2 -pi/2], [-10 0.2], 'color', 'r');
line( [pi/2 pi/2], [-0.2 10], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = tan\itx')
x=[-pi/2+0.05:0.1:pi/2];
y=tan(x);
figure, plot(x,y,'b','LineWidth',3)
hold on
x=-10:0.1:10;
y=atan(x);
plot(x,y,'g','LineWidth',3)
x=-10:0.1:10;
y=x;
plot(x,y,'--c')
hold off
axis([-10 10 -10 10])
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [-pi/2 -pi/2], [-10 0.2], 'color', 'r');
line( [pi/2 pi/2], [-0.2 10], 'color', 'r');
line( [-10 0.2], [-pi/2 -pi/2], 'color', 'b');
line( [-0.2 10], [pi/2 pi/2], 'color', 'b');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = tan\itx')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = tan^{-1}\itx')




%========================================
% cot^-1(x)
%========================================
close all
figure,
x=[0.05:0.1:pi];
y=cot(x);
plot(x,y,'b','LineWidth',3)
axis([-10 10 -10 10])
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [pi pi], [-10 0.2], 'color', 'r');
line( [pi/2 pi/2], [-0.2 0.2], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cot\itx')
x=[0.05:0.1:pi];
y=cot(x);
figure, plot(x,y,'b','LineWidth',3)
hold on
x=-10:0.1:-0.1;
y=acot(x)+pi;
x2=0:0.1:10;
y=[y acot(x2)];
plot([x x2],y,'g','LineWidth',3)
x=-10:0.1:10;
y=x;
plot(x,y,'--c')
hold off
axis([-10 10 -10 10])
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [pi pi], [-10 0.2], 'color', 'r');
line( [-10 0.2], [pi pi], 'color', 'b');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cot\itx')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = cot^{-1}\itx')




%========================================
% sec^-1(x) ------nonunique
%========================================
close all
figure,
x=[-pi/2+0.05:0.1:pi/2-0.05];
y=sec(x);
plot(x,y,'--b')
hold on
x3 = x-3*pi;  y=sec(x3);  plot(x3,y,'--b')
x2 = x-2*pi;  y=sec(x2);  plot(x2,y,'--b')
x1 = x-pi;    y=sec(x1);  plot(x1,y,'--b')
x3 = x+3*pi;  y=sec(x3);  plot(x3,y,'--b')
x2 = x+2*pi;  y=sec(x2);  plot(x2,y,'--b')
x1 = x+pi;    y=sec(x1);  plot(x1,y,'--b')
x=[0:0.1:pi/2-0.05];
y=sec(x);
plot(x,y,'b','LineWidth',3)
x=[pi/2+0.05:0.1:pi pi];
y=sec(x);
plot(x,y,'b','LineWidth',3)
axis([-10 10 -10 10])
hold off
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [5*pi/2 5*pi/2], [-10 10], 'color', 'r');
line( [3*pi/2 3*pi/2], [-10 10], 'color', 'r');
line( [pi/2 pi/2], [-10 10], 'color', 'r');
line( [-5*pi/2 -5*pi/2], [-10 10], 'color', 'r');
line( [-3*pi/2 -3*pi/2], [-10 10], 'color', 'r');
line( [-pi/2 -pi/2], [-10 10], 'color', 'r');
line( [-0.5 0.5], [1 1], 'color', 'r');
line( [-0.4 pi+0.4], [-1 -1], 'color', 'r');
line( [pi pi], [-1.4 0.4], 'color', 'r');
line( [2*pi 2*pi], [-0.4 1.4], 'color', 'r');
line( [-pi -pi], [-1.4 0.4], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('1')
gtext('-1')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{10}\rm3{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm2{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm-{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = sec\itx')
figure,
x=[-pi/2+0.05:0.1:pi/2-0.05];
y=sec(x);
plot(x,y,'--b')
hold on
x3 = x-3*pi;  y=sec(x3);  plot(x3,y,'--b')
x2 = x-2*pi;  y=sec(x2);  plot(x2,y,'--b')
x1 = x-pi;    y=sec(x1);  plot(x1,y,'--b')
x3 = x+3*pi;  y=sec(x3);  plot(x3,y,'--b')
x2 = x+2*pi;  y=sec(x2);  plot(x2,y,'--b')
x1 = x+pi;    y=sec(x1);  plot(x1,y,'--b')
x=[0:0.1:pi/2-0.05];
y=sec(x);
plot(x,y,'b','LineWidth',3)
x=[pi/2+0.05:0.1:pi pi];
y=sec(x);
plot(x,y,'b','LineWidth',3)
x=[-10:0.1:-1];
y=asec(x);
plot(x,y,'g','LineWidth',3)
x=[1:0.1:10];
y=asec(x);
plot(x,y,'g','LineWidth',3)
x=-10:0.1:10;
y=x;
plot(x,y,'--c')
hold off
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [pi/2 pi/2], [-10 10], 'color', 'r');
line( [-0.5 0.5], [1 1], 'color', 'r');
line( [-0.4 pi+0.4], [-1 -1], 'color', 'r');
line( [pi pi], [-1.4 0.4], 'color', 'r');
line( [-10 0.4], [pi pi], 'color', 'b');
line( [-1 -1], [-0.4 pi+0.4], 'color', 'b');
line( [1 1], [-0.4 0.4], 'color', 'b');
axis([-10 10 -10 10])
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('(0,0)')
gtext('1')
gtext('-1')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi} /2')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('-1')
gtext('1')
gtext('\fontname{Times New Roman}\fontsize{10}\rm{\it\pi}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = sec\itx')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = sec^{-1}\itx')



%========================================
% csc^-1(x) ------nonunique
%========================================
close all
figure,
x=[0.05:0.1:pi-0.05];
y=csc(x);
plot(x,y,'--b')
hold on
x3 = x-3*pi;  y=csc(x3);  plot(x3,y,'--b')
x2 = x-2*pi;  y=csc(x2);  plot(x2,y,'--b')
x1 = x-pi;    y=csc(x1);  plot(x1,y,'--b')
x3 = x+3*pi;  y=csc(x3);  plot(x3,y,'--b')
x2 = x+2*pi;  y=csc(x2);  plot(x2,y,'--b')
x1 = x+pi;    y=csc(x1);  plot(x1,y,'--b')
x=[0:0.1:pi/2 pi/2];
y=csc(x);
plot(x,y,'b','LineWidth',3)
x=[-pi/2:0.1:-0.05 -0.05];
y=csc(x);
plot(x,y,'b','LineWidth',3)
axis([-10 10 -10 10])
hold off
line( [0 0], [-10 10], 'color', 'm');
line( [-10 10], [0 0], 'color', 'm');
line( [5*pi/2 5*pi/2], [-10 10], 'color', 'r');
line( [3*pi/2 3*pi/2], [-10 10], 'color', 'r');
line( [pi/2 pi/2], [-10 10], 'color', 'r');
line( [-5*pi/2 -5*pi/2], [-10 10], 'color', 'r');
line( [-3*pi/2 -3*pi/2], [-10 10], 'color', 'r');
line( [-pi/2 -pi/2], [-10 10], 'color', 'r');
line( [-0.5 0.5], [1 1], 'color', 'r');
line( [-0.4 pi+0.4], [-1 -1], 'color', 'r');
line( [pi pi], [-1.4 0.4], 'color', 'r');
line( [2*pi 2*pi], [-0.4 1.4], 'color', 'r');
line( [-pi -pi], [-1.4 0.4], 'color', 'r');
gtext('\fontname{Times New Roman}\fontsize{12}{\itx}')
gtext('\fontname{Times New Roman}\fontsize{12}{\ity}')
gtext('\fontname{Times New Roman}\fontsize{12}{\itf}\rm({\itx}) = csc\itx')