Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I see justification of solution?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28398] Re: How do I see justification of solution?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 16 Apr 2001 03:28:50 -0400 (EDT)
  • References: <9b8ota$7f5@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

David,
See
            www.calc101.com

See also

Help>HelpBrowser>Getting Started/Demos>Demos>Step-by-Step Differentiation.

You might be interested my reply, below (****** ),to an earlier question
about the latter:

To read this as a Mathematica notebook,  copy from immediately below
        BEGIN
to immediately above
        END

Then try to paste the result into a Mathematica notebook.
Click the Yes button on the panel that comes up.

Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


(******)

BEGIN

Notebook[{
Cell[TextData[{
  "Danny Mathews <",
  StyleBox["dmathews at ticnet.com",
    FontColor->RGBColor[0, 0, 0.996109],
    FontVariations->{"Underline"->True}],
  "> wrote in message\n",
  StyleBox["news:805vjq$ddu at smc.vnet.net",
    FontColor->RGBColor[0, 0, 0.996109],
    FontVariations->{"Underline"->True}],
  "...\n> I was using the \"StepbyStepDifferentiation\" package I \
found on the web\nsite\n> and it has raised a question for me.\n>\n> \
It seems that Mathematica ignores the Quotient Rule in general and \
uses\nthe\n> Product Rule for equations in a f(x)/g(x) format.\n>\n> \
This leaves the solution in a f(x) + g(x) format that I have to \
simplify\nto\n> get the answer to agree with what I came up with \
using a pencil or on my\n> TI-89 calculator.\n>\n> An example is \
(1+x^2)/(1-x^2). I came up with(as did my TI-89)\n> 4x/((x^2-1)^2) \
for a solution.\n>\n> Mathematica gives a answer in the form of f(x) \
+ g(x) that will simplify\nto\n> the solution above. I tried several \
examples with the same scenario. Is\n> there something I can do about \
this?\n\n",
  ""
}], "Text"],

Cell[CellGroupData[{

Cell["Step by Step Differentiation", "Subtitle"],

Cell[TextData[{
  "As you note,  ",
  Cell[BoxData[
      \(RunD[f[x]\/g[x], x]\)]],
  ",  gives the same as the built-in function:"
}], "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(D[f[x]/g[x], x]\)], "Input"],

Cell[BoxData[
    RowBox[{
      FractionBox[
        RowBox[{
          SuperscriptBox["f", "\[Prime]",
            MultilineFunction->None], "[", "x", "]"}], \(g[x]\)], "-",

      FractionBox[
        RowBox[{\(f[x]\), " ",
          RowBox[{
            SuperscriptBox["g", "\[Prime]",
              MultilineFunction->None], "[", "x",
            "]"}]}], \(g[x]\^2\)]}]], "Output"]
}, Open  ]],

Cell["You want", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    RowBox[{"%", \(\(\(file\)\(:\)\)\(//\)\), "Together", "  ",
      StyleBox[\( (*quicker\ for\ this\ than\ Simplify*) \),
        FontWeight->"Plain"]}]], "Input"],

Cell[BoxData[
    FractionBox[
      RowBox[{
        RowBox[{\(g[x]\), " ",
          RowBox[{
            SuperscriptBox["f", "\[Prime]",
              MultilineFunction->None], "[", "x", "]"}]}], "-",
        RowBox[{\(f[x]\), " ",
          RowBox[{
            SuperscriptBox["g", "\[Prime]",
              MultilineFunction->None], "[", "x", "]"}]}]}], \(g[
            x]\^2\)]], "Output"]
}, Open  ]],

Cell["\<\
We can change the code of (a copy of)  Step by Step Differentiation \
to give
what you want as follow;\
\>", "Text"],

Cell["(1) Change", "Text"],

Cell[BoxData[
    RowBox[{
      RowBox[{"RuleNames", "=",
        RowBox[{"{", "\n", "\t\t",
          RowBox[{
          "\"\<SpecificRules\>\"", ",", "\n", "\t\t",
            "\"\<ConstantRule\>\"", ",", "\n", "\t\t",
            "\"\<LinearityRule\>\"", ",", "\n", "\t\t",
            "\"\<PowerRule\>\"", ",", "\n", "\t\t",
            StyleBox["\"\<ProductRule\>\"",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox[",",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\n",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\t\t",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\"\<QuotientRule\>\"",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox[",",
              FontColor->RGBColor[0, 0, 1]], "\n", "\t\t",
            "\"\<InverseFunctionRule\>\"", ",", "\n", "\t\t",
            "\"\<ChainRule\>\""}], "\n", "\t\t\t", "}"}]}],
      ";"}]], "Input"],

Cell["\<\
so that \"QuotientRule\" comes before, and so is used before, \
\"ProductRule\", thus:\
\>", "Text"],

Cell[BoxData[
    RowBox[{
      RowBox[{"RuleNames", "=",
        RowBox[{"{", "\n", "\t\t",
          RowBox[{
          "\"\<SpecificRules\>\"", ",", "\n", "\t\t",
            "\"\<ConstantRule\>\"", ",", "\n", "\t\t",
            "\"\<LinearityRule\>\"", ",", "\n", "\t\t",
            StyleBox["\"\<PowerRule\>\"",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox[",",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\[IndentingNewLine]",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\t ",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox["\"\<QuotientRule\>\"",
              FontColor->RGBColor[0, 0, 1]],
            StyleBox[",",
              FontColor->RGBColor[0, 0, 1]], "\n", "\t\t",
            "\"\<ProductRule\>\"", ",", "\n", "\t\t",
            "\"\<InverseFunctionRule\>\"", ",", "\n", "\t\t",
            "\"\<ChainRule\>\""}], "\n", "\t\t\t", "}"}]}],
      ";"}]], "Input"],

Cell["(2) at the end of", "Text"],

Cell[BoxData[
    \(WalkD[f_, x_] :=
      Module[{derivative},
        derivative = d[f, x]; \n\t\tdisplayStart[
          derivative]; \n\t\tWhile[\[InvisibleSpace]\(! \((FreeQ[
                derivative, d])\)\), \n\t\t\toldderivative =
            derivative;
          k = 0; \n\t\t\tWhile[
            oldderivative ==
              derivative, \n\t\t\t\t\(k++\); \n\t\t\t\tderivative =
              derivative /.
                ListRules\[LeftDoubleBracket]k\[RightDoubleBracket]];
          displayRuleUsed[
            RuleNames\[LeftDoubleBracket]k\[RightDoubleBracket]]; \n\t\
\t\tdisplayDerivative[derivative]]; \n\t\t\[PartialD]\_x
          f]\)], "Input"],

Cell[TextData[{
  "Change ",
  Cell[BoxData[
      \(\[PartialD]\_x f\)]],
  " to ",
  StyleBox["derivative", "Input",
    FontWeight->"Plain"],
  "\nThis is needed because  the output from the given WalkD is not \
the result of the earlier steps but is the freshly computed output \
from  D[f,x]"
}], "Text"],

Cell[" 3) Change RunD similarly", "Text"],

Cell["\<\

Now load the new code.
We get\
\>", "Text"],

Cell[CellGroupData[{

Cell[BoxData[
    \(WalkD[f[x]/g[x], x]\)], "Input"],

Cell[BoxData[
    \(d[f[x]\/g[x], x]\)], "Output",
  CellFrame->{{0, 0}, {0, 3}},
  CellMargins->{{Inherited, Inherited}, {0, Inherited}},
  CellEditDuplicate->False,
  CellGroupingRules->"OutputGrouping",
  FontWeight->"Bold",
  Background->RGBColor[0.8, 1, 0.8]],

Cell[BoxData[
    \(QuotientRule\)], "Output",
  CellFrame->False,
  CellMargins->{{Inherited, Inherited}, {0, 0}},
  CellEditDuplicate->False,
  CellFrameMargins->{{100, Inherited}, {0, 0}},
  FontWeight->"Bold",
  FontSlant->"Italic",
  FontColor->RGBColor[0.6, 0, 0.6],
  Background->RGBColor[0.8, 1, 0.8]],

Cell[BoxData[
    RowBox[{
      InterpretationBox["=",
        Sequence[ ]],
      "    ", \(\(\(-d[g[x], x]\)\ f[x] +
            d[f[x], x]\ g[x]\)\/g[x]\^2\)}]], "Output",
  CellFrame->False,
  CellMargins->{{Inherited, Inherited}, {0, 0}},
  CellEditDuplicate->False,
  Evaluatable->False,
  FontWeight->"Bold",
  Background->RGBColor[0.8, 1, 0.8]],

Cell[BoxData[
    \(SpecificRules\)], "Output",
  CellFrame->False,
  CellMargins->{{Inherited, Inherited}, {0, 0}},
  CellEditDuplicate->False,
  CellFrameMargins->{{100, Inherited}, {0, 0}},
  FontWeight->"Bold",
  FontSlant->"Italic",
  FontColor->RGBColor[0.6, 0, 0.6],
  Background->RGBColor[0.8, 1, 0.8]],

Cell[BoxData[
    RowBox[{
      InterpretationBox["=",
        Sequence[ ]], "    ",
      FractionBox[
        RowBox[{
          RowBox[{\(g[x]\), " ",
            RowBox[{
              SuperscriptBox["f", "\[Prime]",
                MultilineFunction->None], "[", "x", "]"}]}], "-",
          RowBox[{\(f[x]\), " ",
            RowBox[{
              SuperscriptBox["g", "\[Prime]",
                MultilineFunction->None], "[", "x", "]"}]}]}], \(g[
              x]\^2\)]}]], "Output",
  CellFrame->False,
  CellMargins->{{Inherited, Inherited}, {0, 0}},
  CellEditDuplicate->False,
  Evaluatable->False,
  FontWeight->"Bold",
  Background->RGBColor[0.8, 1, 0.8]],

Cell[BoxData[
    FractionBox[
      RowBox[{
        RowBox[{\(g[x]\), " ",
          RowBox[{
            SuperscriptBox["f", "\[Prime]",
              MultilineFunction->None], "[", "x", "]"}]}], "-",
        RowBox[{\(f[x]\), " ",
          RowBox[{
            SuperscriptBox["g", "\[Prime]",
              MultilineFunction->None], "[", "x", "]"}]}]}], \(g[
            x]\^2\)]], "Output"]
}, Open  ]],

Cell[TextData[{
  "WARNING: there may  have been a reason for the original ordering \
of ",
  StyleBox["RuleNames", "Input",
    FontWeight->"Plain"],
  ", so look out."
}], "Text"]
}, Open  ]]
},
FrontEndVersion->"4.1 for Microsoft Windows",
ScreenRectangle->{{0, 1024}, {0, 695}},
WindowSize->{496, 740},
WindowMargins->{{172, Automatic}, {Automatic, 136}}
]

END


--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"David Marshall" <marshall at cs.umass.edu> wrote in message
news:9b8ota$7f5 at smc.vnet.net...
> I want to see how Mathematica solves the problem I give it;  Not
> just the sub-expressions that Trace puts out.
>
> Ex.  If I give it Find the derivative of D[sin(x^2 + 5x),x]
> I'd like to see:
>    Chain Rule (...)
>    sum Rule (x^2 + 5x)
>    power rule (x^2)
>    .
> ..
> ..
>
> Isn't there some way to get the thing to show the steps it took to solve
> a problem?
>




  • Prev by Date: Re: Re: Why the Interpolation function cannot make a serious of points be linked smoothly?
  • Next by Date: MatrixTemplate (Simplification)
  • Previous by thread: RE: How do I see justification of solution?
  • Next by thread: matrix