Re: [Q] Implementing identities as rules
- To: mathgroup at smc.vnet.net
- Subject: [mg18678] Re: [mg18608] [Q] Implementing identities as rules
- From: BobHanlon at aol.com
- Date: Thu, 15 Jul 1999 01:45:58 -0400
- Sender: owner-wri-mathgroup at wolfram.com
A definition is always applied. Consequently, avoid the definition. One
approach for symbolic manipulation is as follows:
Notebook[{
Cell[BoxData[
\(\(toEqn[a_\ -> \ b_]\ := \ \((a\ == \ b)\);\)\)], "Input"],
Cell[BoxData[
\(\(eqn1\ = \ f[x, \ y]\ == \ Exp[x^2\ + \ y^2];\)\)], "Input"],
Cell[CellGroupData[{
Cell[BoxData[
\(eqn2\ = \ D[eqn1, \ x]\)], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{
SuperscriptBox["f",
TagBox[\((1, 0)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}],
"==", \(2\ \[ExponentialE]\^\(x\^2 + y\^2\)\ x\)}]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(eqn3\ = \
eqn2\ /. \ \((subst1\ = \
eqn1[\([2]\)]\ -> \ eqn1[\([1]\)])\)\)], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{
SuperscriptBox["f",
TagBox[\((1, 0)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}],
"==", \(2\ x\ f[x, y]\)}]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(eqn4\ = \ D[eqn1, \ y]\)], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{
SuperscriptBox["f",
TagBox[\((0, 1)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}],
"==", \(2\ \[ExponentialE]\^\(x\^2 + y\^2\)\ y\)}]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(eqn5\ = \ eqn4\ /. \ subst1\)], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{
SuperscriptBox["f",
TagBox[\((0, 1)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}],
"==", \(2\ y\ f[x, y]\)}]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(\(Solve[{eqn3, \ eqn5}, \ eqn2[\([1]\)], \ eqn1[\([1]\)]]\)[\([1, \
1]\)]\ // \ toEqn\)], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{
SuperscriptBox["f",
TagBox[\((1, 0)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}], "==",
FractionBox[
RowBox[{"x", " ",
RowBox[{
SuperscriptBox["f",
TagBox[\((0, 1)\),
Derivative],
MultilineFunction->None], "[", \(x, y\), "]"}]}],
"y"]}]], "Output"]
}, Open ]]
},
FrontEndVersion->"4.0 for Macintosh",
ScreenRectangle->{{0, 1024}, {0, 748}},
WindowSize->{520, 626},
WindowMargins->{{Automatic, 118}, {Automatic, 4}},
ShowCellLabel->False,
MacintoshSystemPageSetup->"\<\
00<0001804P000000]P2:?oQon82n at 960dL5:0?l0080001804P000000]P2:001
0000I00000400`<300000BL?00400 at 0000000000000006P801T1T00000000000
00000000000000000000000000000000\>"
]
Bob Hanlon
In a message dated 7/13/99 7:26:26 AM, kj0 at mailcity.com writes:
>During symbolic manipulations it often important to be able to use
>both sides of an identity or definition. For example, let f be a
>function defined by
>
>In[1]:= f = Function[{x, y}, Exp[x^2 + y^2]];
>
>Its partial derivative with respect to x is:
>
>In[2]:= D[f[x, y], x]
>
> 2 2
> x + y
>Out[2]= 2 E x
>
>Now, I want to recast this result in the form 2 x f[x, y], i.e. I want
>to revert to the "left-hand side" of the original definition of f[x,
>y]. How does one do this in Mathematica?
>