expand
expand an expression
Calling Sequence
Parameters
Description
Examples
expand(expr, expr1, expr2, ..., exprn)
expr
-
any algebraic expression
expr[1], expr[2], ..., expr[n]
(optional) expressions
The expand command distributes products over sums. This is done for all polynomials. For quotients of polynomials, only sums in the numerator are expanded; products and powers are left alone. See the normal command for dealing with quotients of polynomials.
The expand command also expands most mathematical functions, including AngerJ, BesselI, BesselJ, BesselK, BesselY, Beta, ChebyshevT, ChebyshevU, CylinderD, CylinderU, CylinderV, Dirac, Ei, GAMMA, GegenbauerC, HankelH1, HankelH2, HermiteH, JacobiAM, JacobiCD, JacobiCN, JacobiCS, JacobiDC, JacobiDN, JacobiDS, JacobiNC, JacobiND, JacobiNS, JacobiP, JacobiSC, JacobiSD, JacobiSN, JacobiTheta1, JacobiTheta2, JacobiTheta3, JacobiTheta4, JacobiZeta, KelvinBei, KelvinBer, KelvinHei, KelvinHer, KelvinKei, KelvinKer, LaguerreL, LegendreP, LegendreQ, LerchPhi, Psi, StruveH, StruveL, WeberE, WeierstrassP, WeierstrassPPrime, WeierstrassSigma, WeierstrassZeta, Zeta, abs, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, bernoulli, binomial, cos, cosh, cot, coth, csc, csch, csgn, dilog, erf, erfc, euler, exp, factorial, ln, pochhammer, polylog, sec, sech, signum, sin, sinh, tan, and tanh.
The optional arguments expr1, expr2, ..., exprn are used to prevent particular subexpressions in expr from being expanded. To prevent all expressions from being expanded, use the frontend command: frontend(expand, [expr]);
The expand command is extensible: if the procedure `expand/f` is defined, then the call expand(f(x)); calls `expand/f`(x);
expand⁡x+1⁢x+2
x2+3⁢x+2
expand⁡x+1x+2
xx+2+1x+2
expand⁡1x+1⁢x
1x+1⁢x
expand⁡sin⁡x+y
sin⁡x⁢cos⁡y+cos⁡x⁢sin⁡y
expand⁡cos⁡2⁢x
2⁢cos⁡x2−1
expand⁡exp⁡a+ln⁡b
ⅇa⁢b
expand⁡x+1⁢y+z
x⁢y+x⁢z+y+z
Do not fully expand an expression.
expand⁡x+1⁢y+z,x+1
x+1⁢y+x+1⁢z
The expand command will only expand an expression if it is possible.
expand⁡ln⁡x1−x2
ln⁡x1−x2
assume⁡x,real
−ln⁡1−x~2+ln⁡x~
The expand command works on more advanced functions.
expand⁡BesselJ⁡2,t
2⁢BesselJ⁡1,tt−BesselJ⁡0,t
expand⁡LegendreQ⁡2,t
−ln⁡t+14+ln⁡t−14+3⁢t2⁢ln⁡t+14−3⁢t2⁢ln⁡t−14−3⁢t2
expand⁡JacobiP⁡3,1,14,t
−3071024−22471024⁢t+15751024⁢t2+50751024⁢t3
To selectively prevent expansions of subexpressions, it is frequently useful to use indets, to get subexpressions of certain type, and pass the operands of its output as extra arguments to expand.
ee≔a+b⁢z+sin⁡a+b+exp⁡a+b
ee≔a+b⁢z+sin⁡a+b+ⅇa+b
By default products and functions are expanded.
expand⁡ee
z⁢a+z⁢b+sin⁡a⁢cos⁡b+cos⁡a⁢sin⁡b+ⅇa⁢ⅇb
Avoid expanding sin(a+b)
expand⁡ee,sin⁡a+b
z⁢a+z⁢b+sin⁡a+b+ⅇa⁢ⅇb
Avoid expanding the exponential function.
expand⁡ee,op⁡indets⁡ee,specfunc⁡anything,exp
z⁢a+z⁢b+sin⁡a⁢cos⁡b+cos⁡a⁢sin⁡b+ⅇa+b
Avoid expanding the exponential and sine functions.
expand⁡ee,op⁡indets⁡ee,specfunc⁡anything,exp,sin
z⁢a+z⁢b+ⅇa+b+sin⁡a+b
Avoid expanding all functions.
expand⁡ee,op⁡indets⁡ee,function
See Also
assume
collect
combine
convert
Expand
expandoff
expandon
ExtendingMaple
factor
frontend
indets
normal
op
RealDomain
sort
type/expanded
Download Help Document