Student[Basics] - Maple Programming Help

Home : Support : Online Help : Education : Student Package : Basics : Student/Basics/LinearSolveSteps

Student[Basics]

 LinearSolveSteps
 generates core steps for solving equations for a given variable

 Calling Sequence Student[Basics][LinearSolveSteps]( expr, var ) Student[Basics][LinearSolveSteps]( expr, var, implicitmultiply = true )

Parameters

 expr - string or expression var - symbol (variable to solve for) implicitmultiply - truefalse (optional)

Description

 • The LinearSolveSteps command accepts an expression, expr in the given variable, var, and displays the steps required to solve for that variable.
 • Note that this command also accepts some nonlinear equations that can be reduced down to linear equations (in other words, you can isolate $x$ on one side of the equation, and there is only one solution).
 • If expr is a string, then it is parsed into an expression using InertForm:-Parse so that no automatic simplifications are applied, and thus no steps are missed.
 • The implicitmultiply option is only relevant when expr is a string.  This option is passed directly on to the InertForm:-Parse command and will cause things like "2x" to be interpreted as 2*x, but also, "xyz" to be interpreted as x*y*z.
 • A step may show up where the expression is not obviously different from the previous step.  This can happen when the underlying data structure is transformed during the step, and it is not obvious that the resulting structure is the same as the original, but just expressed differently.  This becomes more apparent when looking at the inert-form of the raw data.
 • The return value is a module that display annotated steps by default.  This module also has callable methods and data members: data, numsteps, step, and toMathML.

data: a numsteps x 2 array where column 1 is the inert-form expression, and column 2 is the annotation.  R:-data[1,1] is the original expression in inert-form.

numsteps: the number of steps in the solution, including the original expression.

step(i): a method for displaying individual steps.  Calling R:-step(i) will display the ith typeset expression and annotation.  Step 1 is the original expression.

toMathML(): a method for converting the sequence of steps and annotations into mathml.  The toMathML command optionally takes one or two arguments: (1) a filename, indicating the mathml should be written to the specified file, and (2) the option htmlheader=true, which will also cause html tags to be written along with the mathml, thus generating a complete .html page that can be loaded in a browser.

Package Usage

 • This function is part of the Student[Basics] package, so it can be used in the short form LinearSolveSteps(..) only after executing the command with(Student[Basics]). However, it can always be accessed through the long form of the command by using Student[Basics][LinearSolveSteps](..).

Examples

 > $\mathrm{with}\left(\mathrm{Student}[\mathrm{Basics}]\right):$
 > $\mathrm{LinearSolveSteps}\left(\frac{x+1}{2yz}=\frac{4{y}^{2}}{z}+\frac{3x}{y},x\right)$
 $\begin{array}{c}\frac{{x}{+}{1}}{{2}{}{y}{}{z}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}{+}\frac{{3}{}{x}}{{y}}\\ \frac{{x}{+}{1}}{{2}{}{y}{}{z}}{-}\frac{{3}{}{x}}{{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{subtract from both sides}}\right)\\ \frac{{y}{}\left({x}{+}{1}\right)}{{2}{}{y}{}{z}{}{y}}{+}\frac{{2}{}{y}{}{z}{}\left({-}{3}{}{x}\right)}{{2}{}{y}{}{z}{}{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{find common denominator}}\right)\\ \frac{{y}{}\left({x}{+}{1}\right){+}{2}{}{y}{}{z}{}\left({-}{3}{}{x}\right)}{{2}{}{y}{}{z}{}{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{sum over common denominator}}\right)\\ \frac{{y}{}{x}{+}{y}{·}{1}{+}{2}{}{y}{}{z}{}\left({-}{3}{}{x}\right)}{{2}{}{y}{}{z}{}{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{distributive multiply}}\right)\\ \frac{{y}{}{x}{+}{y}{+}\left({-6}\right){}{y}{}{z}{}{x}}{{2}{}{y}{}{z}{}{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{multiply constants}}\right)\\ \frac{{-}{6}{}{y}{}{z}{}{x}{+}{y}{}{x}{+}{y}}{{2}{}{y}{}{z}{}{y}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{reorder terms}}\right)\\ \frac{{y}{}\left({-}{6}{}{x}{}{z}{+}{x}{+}{1}\right)}{{y}{·}{2}{}{y}{}{z}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{factor}}\right)\\ \frac{{-}{6}{}{x}{}{z}{+}{x}{+}{1}}{{2}{}{y}{}{z}}{=}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{divide}}\right)\\ {-}{6}{}{x}{}{z}{+}{x}{+}{1}{=}{2}{}{y}{}{z}{}\frac{{4}{}{{y}}^{{2}}}{{z}}& \left({\mathrm{multiply rhs by denominator of lhs}}\right)\\ {-}{6}{}{x}{}{z}{+}{x}{=}{2}{}{y}{}{z}{}\frac{{4}{}{{y}}^{{2}}}{{z}}{-}{1}& \left({\mathrm{subtract from both sides}}\right)\\ {-}{6}{}{x}{}{z}{+}{x}{=}\frac{{8}{}{{y}}^{{3}}{}{z}}{{z}}{-}{1}& \left({\mathrm{multiply fraction}}\right)\\ {-}{6}{}{x}{}{z}{+}{x}{=}{8}{}{{y}}^{{3}}{-}{1}& \left({\mathrm{divide}}\right)\\ {x}{}\left({1}{-}{6}{}{z}\right){=}{8}{}{{y}}^{{3}}{-}{1}& \left({\mathrm{factor}}\right)\\ {x}{=}\frac{{8}{}{{y}}^{{3}}{-}{1}}{{1}{-}{6}{}{z}}& \left({\mathrm{divide both sides}}\right)\end{array}$ (1)

Note that the result is a module with callable methods

 > $\mathrm{ex}≔\mathrm{LinearSolveSteps}\left(\frac{1}{x}-\frac{1}{2}=\frac{3}{4}-\frac{2}{x},x\right)$
 ${\mathrm{ex}}{≔}\begin{array}{c}{{x}}^{{-1}}{-}\frac{{1}}{{2}}{=}\frac{{3}}{{4}}{+}\frac{{-2}}{{x}}\\ {{x}}^{{-1}}{-}\frac{{-2}}{{x}}{=}\frac{{3}}{{4}}{+}\frac{{1}}{{2}}& \left({\mathrm{subtract from both sides}}\right)\\ \frac{{1}}{{x}}{+}\frac{{2}}{{x}}{=}\frac{{3}}{{4}}{+}\frac{{1}}{{2}}& \left({\mathrm{distribute negation}}\right)\\ \frac{{3}}{{x}}{=}\frac{{3}}{{4}}{+}\frac{{1}}{{2}}& \left({\mathrm{add terms}}\right)\\ \frac{{3}}{{x}}{=}\frac{{5}}{{4}}& \left({\mathrm{add terms}}\right)\\ \frac{{x}}{{3}}{=}\frac{{4}}{{5}}& \left({\mathrm{reciprocal of both sides}}\right)\\ {x}{=}\frac{\frac{{4}}{{5}}}{\frac{{1}}{{3}}}& \left({\mathrm{divide both sides}}\right)\\ {x}{=}\frac{{4}}{{5}}{}\frac{{3}}{{1}}& \left({\mathrm{rewrite division as multiplication by reciprocal}}\right)\\ {x}{=}\frac{{12}}{{5}}& \left({\mathrm{multiply fraction and reduce by gcd}}\right)\end{array}$ (2)
 > $\mathrm{ex}:-\mathrm{numsteps}$
 ${9}$ (3)
 > $\mathrm{ex}:-\mathrm{step}\left(2\right)$
 $\begin{array}{cc}{{x}}^{{-1}}{-}\frac{{-2}}{{x}}{=}\frac{{3}}{{4}}{+}\frac{{1}}{{2}}& \left({\mathrm{subtract from both sides}}\right)\end{array}$ (4)
 > $\mathrm{ex}:-\mathrm{toMathML}\left(\right)$
 $\left[\begin{array}{ccccccccc}{"^x-1+-12=34+-2x\left[/itex\right]"}& {"^x-1+2x=34+12\left( subtract from both sides \right)\left[/itex\right]"}& {"1x+2x=34+12\left( distribute negation \right)\left[/itex\right]"}& {"3x=34+12\left( add terms \right)\left[/itex\right]"}& {"3x=54\left( add terms \right)\left[/itex\right]"}& {"13 x=45\left( reciprocal of both sides \right)\left[/itex\right]"}& {"x=45 11/3\left( divide both sides \right)\left[/itex\right]"}& {"x=45 31\left( rewrite division as multiplication by reciprocal \right)\left[/itex\right]"}& {"x=125\left( multiply fraction and reduce by gcd \right)\left[/itex\right]"}\end{array}\right]$ (5)

The input can be a string, which prevents automatic simplification

 > $\mathrm{LinearSolveSteps}\left("x + 3^2 = 12",x\right)$
 $\begin{array}{c}{x}{+}{{3}}^{{2}}{=}{12}\\ {x}{=}{12}{-}{{3}}^{{2}}& \left({\mathrm{subtract from both sides}}\right)\\ {x}{=}{12}{-}{9}& \left({\mathrm{evaluate power}}\right)\\ {x}{=}{3}& \left({\mathrm{add terms}}\right)\end{array}$ (6)

The implicitmultiply option allows short-hand for string input.

 > $\mathrm{LinearSolveSteps}\left("3\left(x-2\right) = 0",x,'\mathrm{implicitmultiply}'\right)$
 $\begin{array}{c}{3}{}\left({x}{-}{2}\right){=}{0}\\ {3}{}{x}{+}{3}{}\left({-2}\right){=}{0}& \left({\mathrm{distributive multiply}}\right)\\ {3}{}{x}{-}{6}{=}{0}& \left({\mathrm{multiply constants}}\right)\\ {3}{}{x}{=}{6}& \left({\mathrm{subtract from both sides}}\right)\\ {x}{=}\frac{{6}}{{3}}& \left({\mathrm{divide both sides}}\right)\\ {x}{=}{2}& \left({\mathrm{reduce fraction by gcd}}\right)\end{array}$ (7)

Compatibility

 • The Student[Basics][LinearSolveSteps] command was introduced in Maple 18.