type/linear - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/linear

type/linear

check for linear functions

type/cubic

check for cubic functions

type/quartic

check for quartic functions

 Calling Sequence type(a, linear(v)) type(a, quadratic(v)) type(a, cubic(v)) type(a, quartic(v))

Parameters

 a - expression v - indeterminate or list or set of indeterminates

Description

 • Check if the expression a is linear (quadratic, cubic, or quartic) in the indeterminates v.  If v is not specified, this is equivalent to the call type(a, linear(indets(a))) That is, a must be linear (quadratic, cubic, quartic) in all of its indeterminates.
 • The definition of linear in the indeterminates v is type(a, polynom(anything, v)) and (degree(a, v) = 1) where degree means total degree'' in the case of several variables. The definitions for quadratic, cubic and quartic are analogous with degree(a, v) = 2, 3, and 4 respectively.
 • Note, if you wish to also determine the coefficients, for example, test if a polynomial is of the form $ax+b$ and pick off the coefficients a and b, it is NOT recommended that you use the type test followed by the coeff function. The coeff function requires that the polynomial is expanded (collected) in x, and the type test is only syntactic.  It may return true and a value for a which is in fact mathematically 0.  The ispoly function should be used instead.

Examples

 > $\mathrm{type}\left(xy+z,\mathrm{linear}\left(x\right)\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{type}\left(xy+z,\mathrm{linear}\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{type}\left(xy+z,\mathrm{quadratic}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left({x}^{4}+y,\mathrm{cubic}\left(x\right)\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{type}\left({x}^{4}+y,\mathrm{quartic}\left(x\right)\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{type}\left(\mathrm{gamma}x+f\left(1\right)+{2}^{\frac{1}{2}},\mathrm{linear}\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{type}\left(\frac{x}{z}+\frac{y}{g\left(2\right)},\mathrm{linear}\left(\left[x,y\right]\right)\right)$
 ${\mathrm{true}}$ (7)
 > $f≔\left(a\left(1+a\right)-{a}^{2}-a\right){x}^{2}+a\left(1+a\right)x-\frac{1}{a}-a$
 ${f}{≔}\left({a}{}\left({1}{+}{a}\right){-}{{a}}^{{2}}{-}{a}\right){}{{x}}^{{2}}{+}{a}{}\left({1}{+}{a}\right){}{x}{-}\frac{{1}}{{a}}{-}{a}$ (8)
 > $\mathrm{type}\left(f,\mathrm{quadratic}\left(x\right)\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{type}\left(f,\mathrm{linear}\left(x\right)\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{ispoly}\left(f,\mathrm{quadratic},x,'\mathrm{a0}','\mathrm{a1}','\mathrm{a2}'\right)$
 ${\mathrm{false}}$ (11)
 > $\mathrm{ispoly}\left(f,\mathrm{linear},x,'\mathrm{a0}','\mathrm{a1}'\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{a0},\mathrm{a1}$
 ${-}\frac{{{a}}^{{2}}{+}{1}}{{a}}{,}{a}{}\left({1}{+}{a}\right)$ (13)