 Overview of Single Step Computation in Calculus1 - Maple Programming Help

Home : Support : Online Help : Education : Student Packages : Calculus 1 : Single Stepping : Student/Calculus1/SingleStepOverview

Overview of Single Step Computation in Calculus1

 • See Student[Calculus1] for a general introduction to the Calculus1 subpackage of the Student package and a list of single-step routines.
 • The single step functionality of the Calculus1 package enables you to solve a single-variable calculus computation one step at a time.
 • Single-step functionality is available for the three main types of single-variable calculus problems: differentiation, integration, and limit.
 • To perform a single step of a calculation, use the Rule routine with two parameters: the rule to apply and the expression to which it is applied.  The rule is specified by an index (in brackets) to the Rule command and the expression is passed as the argument. For example, to apply the sum rule to the expression $\frac{{ⅆ}}{{ⅆ}x}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({x}^{2}+x\right)$, enter:
 > Rule[sum](Diff(x^2+x,x));
 • The normal output from Rule is an equation where the left-hand side is the original form of the problem and the right-hand side is the form of the problem after applying the rule. This output can be passed as the argument to another Rule call, the output of which has the same left-hand side and the right-hand side reflects the next rule application.
 • For detailed information on rules for differentiation, integration, and limits, see Differentiation Rules, Integration Rules, and Limit Rules.
 • The Calculus1 package maintains a table of problems that have been defined in single-step mode.  When Rule is invoked, its argument is checked to verify whether it matches a problem in this table. If it does not, a new entry is created for this expression in the problems table before the rule is applied.  The problems table is not directly available to you (it is a private member of the Calculus1 module), but you can refer to problems in the table using commands in the package.  For example, to display the current state of problem #3, enter Show(3).

A Short Example

 Note: Before using the various commands from the Calculus1 package, execute the command with(Student[Calculus1]) (or with(Student:-Calculus1)) so that the short form names of the package commands are available.
 > with(Student[Calculus1]):
 > infolevel[Student[Calculus1]] := 1:
 > Rule[sum](Diff(x^2+x*sin(x),x));
 Creating problem #1
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}\right){+}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({x}{}{\mathrm{sin}}{}\left({x}\right)\right)$ (1)
 > Rule[power]((1));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}{2}{}{x}{+}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({x}{}{\mathrm{sin}}{}\left({x}\right)\right)$ (2)
 > Rule[product]((2));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}{2}{}{x}{+}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}{\mathrm{sin}}{}\left({x}\right){+}{x}{}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{sin}{}\left({x}\right)$ (3)
 • The first step in a single-step computation is the entry of an expression which is an inert form of a limit, differentiation, or integration problem, for example, $\underset{x\to 0+}{{lim}}x\mathrm{ln}\left(x\right)$, $\frac{{ⅆ}}{{ⅆ}x}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({x}^{2}\right)$, or ${{\int }}_{0}^{1}x\mathrm{sin}\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}x$.  In the previous example, the first call to Rule creates a new problem in the package problems table, determines that it is a differentiation problem, and then applies the sum rule for differentiation.
 At any time, you can obtain the final answer by using value.  You can also ask to see the complete solution using the ShowSolution command.
 You can also undo one or more steps of a problem (back to its original form) by using the Undo command.  This command allows you to experiment, which is useful in the study of integration techniques when it is not obvious which rule to apply.
 If you do not know which rule to apply next in a single-step computation, ask for a hint by using the Hint command.  The output from Hint can be used as the rule parameter in a call to Rule.
 It is recommended that you use the Maple infolevel facility by setting infolevel[Student] := 1 or infolevel[Student[Calculus1]] := 1. This displays informative messages from Calculus1 routines. In particular, explanatory text describing complicated hints is provided using this mechanism.
 Create a new problem.
 > Int(x*cos(x), x);
 ${\int }{x}{}{\mathrm{cos}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (4)
 > Hint((4));
 Creating problem #2
 $\left[{\mathrm{parts}}{,}{x}{,}{\mathrm{sin}}{}\left({x}\right)\right]$ (5)
 > Rule[(5)]((4));
 ${\int }{x}{}{\mathrm{cos}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{=}{x}{}{\mathrm{sin}}{}\left({x}\right){-}\left({\int }{\mathrm{sin}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}\right)$ (6)
 At this point you can continue working with this problem, return to the previous problem, get state information about either problem, or start a new problem.
 Finish problem #2.
 > Rule[sin]((6));
 ${\int }{x}{}{\mathrm{cos}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{=}{x}{}{\mathrm{sin}}{}\left({x}\right){+}{\mathrm{cos}}{}\left({x}\right)$ (7)
 > GetProblem(1, internal);
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}{2}{}{x}{+}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}{\mathrm{sin}}{}\left({x}\right){+}{x}{}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{sin}{}\left({x}\right)$ (8)
 Apply the identity rule.
 > Rule[identity]((8));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}{2}{}{x}{+}{\mathrm{sin}}{}\left({x}\right){+}{x}{}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{sin}{}\left({x}\right)$ (9)
 Show the unsolved subproblem.
 > ShowIncomplete();
 ${?}{=}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{sin}{}\left({x}\right)$ (10)
 Apply the sin rule.
 > Rule[sin]((9));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}{+}{x}{}{\mathrm{sin}}{}\left({x}\right)\right){=}{2}{}{x}{+}{\mathrm{sin}}{}\left({x}\right){+}{x}{}{\mathrm{cos}}{}\left({x}\right)$ (11)
 Use the Show routine to display the current state of problem #2.
 > Show(2);
 ${\int }{x}{}{\mathrm{cos}}{}\left({x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{=}{x}{}{\mathrm{sin}}{}\left({x}\right){+}{\mathrm{cos}}{}\left({x}\right)$ (12)
 Create a new limit problem and apply the addition rule.
 > Rule[+](Limit(x^2+exp(x), x=1));
 Creating problem #3
 $\underset{{x}{\to }{1}}{{lim}}{}\left({{x}}^{{2}}{+}{{ⅇ}}^{{x}}\right){=}\left(\underset{{x}{\to }{1}}{{lim}}{}{{x}}^{{2}}\right){+}\left(\underset{{x}{\to }{1}}{{lim}}{}{{ⅇ}}^{{x}}\right)$ (13)

Getting Information

 • There are three commands in the Calculus1 package that you can use to obtain information about the current state of any or all problems that are defined in a Maple session: Show, ShowSteps, and ShowIncomplete.  Show is used to display the current state of a problem.  ShowSteps displays all the steps between the initial and current state of the problem. ShowIncomplete is explained in the following paragraphs.
 Each problem in the Calculus1 internal problems table is represented in a form that package routines use to determine, for example, when rules are applied or what is displayed.  In particular, each incomplete subproblem of a problem is assigned a label. The ShowIncomplete command displays these subproblems with their labels.
 You can refer to a subproblem directly by using its label as the argument to package routines, for example, Rule, Show, ShowIncomplete, and GetProblem.  This focuses the corresponding routine on a particular subproblem and its subproblems, if any. In integration, differentiation, or limit problems, if a rule applies to more than one subproblem of the current problem, use the ShowIncomplete command to select a subproblem. For example:
 > Int(sin(2*x) + cos(3*x),x);
 ${\int }\left({\mathrm{sin}}{}\left({2}{}{x}\right){+}{\mathrm{cos}}{}\left({3}{}{x}\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (14)
 > Rule[+]((14));
 Creating problem #4
 ${\int }\left({\mathrm{sin}}{}\left({2}{}{x}\right){+}{\mathrm{cos}}{}\left({3}{}{x}\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{=}{\int }{\mathrm{sin}}{}\left({2}{}{x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{+}{\int }{\mathrm{cos}}{}\left({3}{}{x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (15)
 > ShowIncomplete();
 ${?}{=}{\int }{\mathrm{sin}}{}\left({2}{}{x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$
 ${?}{=}{\int }{\mathrm{cos}}{}\left({3}{}{x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}$ (16)
 > Rule[change, u=3*x](%Int14);
 Applying substitution x = 1/3*u, u = 3*x with dx = 1/3*du, du = 3*dx
 ${\int }{\mathrm{cos}}{}\left({3}{}{x}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}{=}{\int }\frac{{\mathrm{cos}}{}\left({u}\right)}{{3}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{u}$ (17)
 Note: The displays produced by these three commands are printed only; they are not the return values of the commands.  The return values are NULL. This means, for example, that the value of the history variable, %, is not changed by these commands.  (ShowIncomplete takes an option that requests that it return its output as the value of the routine; if this option is given, the history variable is updated.)
 Note: Treat subproblem labels as temporary objects because the application of a rule to a problem can change the underlying problem representation, and hence the subproblem labels.  It is recommended that you call ShowIncomplete to verify the value of a label before passing it to a command.

Learning

 • The methods of single-variable calculus computation proceed from simple (for example, the constant rule for limits) to challenging (for example, change of variables for integration).  It would be tedious if you were required to explicitly apply the elementary rules when learning the more advanced methods.
 The Calculus1 package provides the Understand command to alleviate this problem.  For example, if you execute the $\mathrm{Understand}\left(\mathrm{Diff},\mathrm{constant},\mathrm{c*},\mathrm{+}\right)$ command, whenever you invoke Rule on a differentiation problem it automatically checks whether one or more of the constant, constantmultiple, or sum rules can also be applied.  You can apply just the understood rules to a problem by calling Rule with an empty index (that is, as $\mathrm{Rule}\left[\right]\left(\mathrm{expr}\right)$).
 > Understand(Diff, constant, c*, +);
 ${\mathrm{Diff}}{=}\left[{\mathrm{constant}}{,}{\mathrm{constantmultiple}}{,}{\mathrm{sum}}\right]$ (18)
 Create a new problem. The understood rules are automatically applied.
 > Rule[](Diff(3*sqrt(x)-sin(x), x));
 Creating problem #5
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({3}{}\sqrt{{x}}{-}{\mathrm{sin}}{}\left({x}\right)\right){=}{3}{}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{x}}\right){-}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{sin}{}\left({x}\right)$ (19)
 Create a new problem.
 > Diff(sqrt(x^2+1), x);
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{{x}}^{{2}}{+}{1}}\right)$ (20)
 Request a hint.
 > Hint((20));
 Creating problem #6
 $\left[{\mathrm{chain}}\right]$ (21)
 Apply the hint.
 > Rule[(21)]((20));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{{x}}^{{2}}{+}{1}}\right){=}\left(\genfrac{}{}{0}{}{\frac{{ⅆ}}{{ⅆ}{\mathrm{_X0}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{\mathrm{_X0}}}\right)}{\phantom{{\mathrm{_X0}}{=}{{x}}^{{2}}{+}{1}}}{|}\genfrac{}{}{0}{}{\phantom{\frac{{ⅆ}}{{ⅆ}{\mathrm{_X0}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{\mathrm{_X0}}}\right)}}{{\mathrm{_X0}}{=}{{x}}^{{2}}{+}{1}}\right){}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}\right)$ (22)
 Note: The sum and constant rules have been applied to the derivative of the inner expression.
 > Rule[^]((22));
 $\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\sqrt{{{x}}^{{2}}{+}{1}}\right){=}\frac{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({{x}}^{{2}}\right)}{{2}{}\sqrt{{{x}}^{{2}}{+}{1}}}$ (23)

More Details and Cautions

Internal Representation of Problems

 The Calculus1 package attempts to keep expressions as simple as possible. However, for example, after a change of variables rule is applied to an integral, the resulting integrand may not be simplified.  In such circumstances, it may be beneficial to apply standard Maple commands (for example, normal, simplify, or expand) to the output of the Rule command; the symbolic option, available with certain of these commands, and the assuming operator may be helpful.
 These commands have no effect on the left-hand side of any equation returned by Rule. Although the displayed form of a left-hand side is typically a standard limit, derivative, or integral, the underlying representation of this object is different.  If you use the lprint command, Maple displays its structure, which is similar to:

$\mathrm{CALCULUS1OBJECT}\left(\left[1,\left[\right],\left[\right]\right],\left\{x\right\}\right)=\mathrm{...}$

 This underlying representation allows the package to continue solving a problem after you apply a command, such as normal or simplify, to an expression before passing it to Rule.  Thus, always pass the entire equation as the argument to Rule, not just its right-hand side.
 Most Maple commands do not accept CALCULUS1OBJECTs (the exceptions are diff, int, limit, and series). To work with both sides of an equation returned by a call to Rule, first transform its left-hand side into standard form by using the GetProblem routine (without the internal option).
 To use GetProblem to change the current problem or recover the current problem (see the following paragraph), use the internal option to ensure that the equation returned uses the CALCULUS1OBJECT representation for its left-hand side.
 If you create a problem by passing the first reference to an expression directly to Hint, there is no representation of the problem outside the internal Calculus1 problems table. That is, there is no reference to it. Use GetProblem(internal) to pass the problem as an argument to Rule.
 > Hint(Limit(x*ln(x), x=0, right));
 Creating problem #7
 $\left[{\mathrm{lhopital}}{,}{\mathrm{ln}}{}\left({x}\right)\right]{,}\left[{\mathrm{lhopital}}{,}{x}\right]$ (24)
 > Rule[(24)](GetProblem(internal));
 $\underset{{x}{\to }{0}{+}}{{lim}}{}{x}{}{\mathrm{ln}}{}\left({x}\right){=}\underset{{x}{\to }{0}{+}}{{lim}}{}\left({-}{x}\right)$ (25)

Internal State of Problems

 As discussed above, you can apply standard Maple commands, such as normal or expand, to the output from a Rule call.  However, because these commands are not part of the Calculus1 package, they do not modify the internal state of a problem.  Therefore, if you follow such a command with GetProblem(), the state of the problem is as it was after the last Rule call.  Similarly, if you use Show, ShowSteps, or ShowIncomplete, you do not see the result of the standard Maple command.
 However, as noted previously, if you pass the result of the application of a standard Maple command to Rule or Hint, the internal state of the problem is updated with this new state before the command runs.

Multiple Hints

 For challenging problems, a call to Hint may return more than one suggestion.  The value returned from the call to Hint is then an expression sequence of lists, where each list is a rule.
 You can simply refer to this list as % in the index to Rule; in this case, Rule uses the first rule in the sequence. This means that the construct Rule[Hint(%)](%) is always valid (assuming that % refers to a calculus problem that is valid input to Rule).
 You can also select other hints by referring to % or %, for example.

Example Worksheet

 • For more introductory examples, see Calculus1 Single Stepping Example Worksheet.
 • The following is a list of the available Student[Calculus1] single-stepping routines.