(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 12428, 380]*) (*NotebookOutlinePosition[ 13483, 416]*) (* CellTagsIndexPosition[ 13439, 412]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell[TextData["AlgebraicRulesExtended"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["an extension of AlgebraicRules"], "Subtitle", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[ "Copyright Allan Hayes 1993,1994,1995\nhay@haystack.demon.co.uk"], "Subsubtitle", Evaluatable->False, AspectRatioFixed->True], Cell[TextData["<True], Cell[CellGroupData[{Cell[TextData["Examples"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[ "Getting inside expressions; ordering replecements"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[ "Tan[s^2 - c^2]/.AlgebraicRulesExtended[c^2 + s^2 == 1]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ -Tan[1 - 2*s^2]\ \>", "\<\ 2 -Tan[1 - 2 s ]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "Tan[s^2 - c^2]/.AlgebraicRulesExtended[c^2 + s^2 == 1,{s}]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ Tan[1 - 2*c^2]\ \>", "\<\ 2 Tan[1 - 2 c ]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "Tan[s^2 - c^2]/.\n\tAlgebraicRulesExtended[c^2 + s^2 == 1,{OtherVariables, \ s}] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ -Tan[1 - 2*s^2]\ \>", "\<\ 2 -Tan[1 - 2 s ]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Getting inside heads."], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["a[a]/.AlgebraicRulesExtended[a==b] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ a[b]\ \>", "\<\ a[b]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["a[a]/.AlgebraicRulesExtended[a==b, Heads -> True] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ b[b]\ \>", "\<\ b[b]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Which application method?"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[{ StyleBox[ "Sin[a]^3/.AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]}]", AspectRatioFixed->True], StyleBox[" ", AspectRatioFixed->True, FontWeight->"Plain", FontColor->RGBColor[0, 0, 0.501472]] }], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ Sin[c]^3\ \>", "\<\ 3 Sin[c]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "Sin[a]^3/.AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]},\n \ ApplicationMethod -> 2] "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ p*Sin[c]\ \>", "\<\ p Sin[c]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "ar = AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]}]; \n\ ReplaceAll[Sin[a]^3, ar, ApplicationMethod -> 2]"], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ p*Sin[c]\ \>", "\<\ p Sin[c]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Deciding options at use"], "Subsubsection", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData[ " \n ar = AlgebraicRulesExtended[a==b]; \n ReplaceAll[a[a], ar, Heads->True] \ "], "Input", AspectRatioFixed->True], Cell[OutputFormData["\<\ b[b]\ \>", "\<\ b[b]\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData[ "ar = AlgebraicRulesExtended[a x == b x + 1,x]\nDivisorsUsed/.ar"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ AlgebraicRulesExtendedData[{x == (a - b)^(-1)}, {x, a, b}, FreeQ[#1, Alternatives[x]] & , {a - b}, AlgebraicRulesData[{Solve`SolvVar[x], Solve`RecipVar[(Solve`SolvVar[a] - Solve`SolvVar[b])^(-1)], Solve`SolvVar[a], Solve`SolvVar[b]}, {x, a, b}, -1 + Solve`RecipVar[(Solve`SolvVar[a] - Solve`SolvVar[b])^(-1)]* Solve`SolvVar[a] - Solve`RecipVar[(Solve`SolvVar[a] - Solve`SolvVar[b])^(-1)]*Solve`SolvVar[b] == 0 && -Solve`RecipVar[(Solve`SolvVar[a] - Solve`SolvVar[b])^(-1)] + Solve`SolvVar[x] == 0, {{{1, {{0, {{0, {{0, 1}}}}}}}, {0, {{1, {{0, {{0, -1}}}}}}}}}, {x, (a - b)^(-1), a, b}, {x -> (a - b)^(-1)}, Rational], {InverseFunctions -> Automatic, MakeRules -> True, Method -> 1, Mode -> Rational, Sort -> False, VerifySolutions -> False, WorkingPrecision -> DirectedInfinity[1], Heads -> False, ApplicationMethod -> 1}]\ \>", "\<\ 1 {x -> -----} a - b\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True], Cell[OutputFormData["\<\ {a - b}\ \>", "\<\ {a - b}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Usage Messages"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{Cell[TextData["?AlgebraicRulesExtendedInfo"], "Input", AspectRatioFixed->True], Cell[TextData[ "AlgebraicRulesExtended is a package containing one function,\n \ AlgebraicRulesExtended, which is an extension of the system function\n \ AlgebraicRules. \nAdvantages include: \n(1)it reduces the need to list the \ symbols in the equations and the\n expression; \n(2)it gets at places that \ AlgebraicRules does not reach; \n(3)it uses division to strengthen the rules \ (and provides a list of\n divisors for checking). \n \n More detailed \ information and examples can be found under\n AlgebraicRulesExtended. "], "Print", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["?AlgebraicRulesExtended"], "Input", AspectRatioFixed->True], Cell[TextData[ "AlgebraicRulesExtended[eqns], where eqns is a list of equations or a\n \ single equation, gives an AlgebraicRulesExtendedData object\n containing \ rules derived from eqns for altering expressions by\n replacing variables \ in an expression which are earlier in default\n order by later ones: \ Tan[s^2 - c^2]/.AlgebraicRulesExtended[c^2 + s^2\n == 1] --> -Tan[1- 2s^2]. \ \n \nAlgebraicRulesExtended[eqns, vars], where vars is a list of equations \ or\n a single variable, replaces first in the order defined by vars then\n \ in default order. The special symbol OtherVariables can be used in\n vars: \ it is replaced by the variables in eqns that are not in vars\n (in default \ order). OtherVariables must not occur in eqns. \nTan[s^2 - \ c^2]/.AlgebraicRulesExtended[c^2 + s^2 == 1,{s}] -->\n Tan[1-2c^2]. \n\ Tan[s^2 - c^2]/.AlgebraicRulesExtended[c^2 + s^2 == 1,{OtherVariables,\n \ s}] --> -Tan[1-s^2]. \n \nDivisorsUsed/.AlgebraicRulesExtendedData[...] gives \ the divisors used in\n constructing AlgebraicRulesExtendedData[...] (which \ must be\n non-zero). \n ar = AlgebraicRulesExtended[a x == b x + 1,x]. \n\ DivisorsUsed/.ar --> a-b. \n \nOPTIONS: \nHeads -> True allows changes to \ be made in heads; the default, Heads ->\n False excludes heads. \n \ a[a]/.AlgebraicRulesExtended[a==b] --> a[b]. \n \ a[a]/.AlgebraicRulesExtended[a==b, Heads -> True] --> b[b]. \n \n \ ApplicationMethod -> 1, the default, is faster but less powerful than\n \ ApplicationMethod -> 2. \n Sin[a]^3/.AlgebraicRulesExtended[{a==c, Sin[a]^2 \ == p},{Sin[a]}] -->\n Sin[c]^3 \n Sin[a]^3/.AlgebraicRulesExtended[{a==c, \ Sin[a]^2 == p},{Sin[a]},\n ApplicationMethod -> 2] --> p Sin[c]. \nIn \ addition AlgebraicRulesExtended has the combined options of\n \ AlgebraicRules and Level. \n\nNote: The options ApplicationMethod and Heads \ can also be used when\n applying an AlgebraicRulesExtendedData object given \ by\n AlgebraicRulesExtended to an expression: \n ar = \ AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]}] \n \ ReplaceAll[Sin[a]^3, ar, ApplicationMethod -> 2] --> p Sin[c]. \n ar = \ AlgebraicRulesExtended[a==b] \n ReplaceAll[a[a], \ AlgebraicRulesExtended[a==b], Heads->True] --> b[b]. "], "Print", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["?OtherVariables"], "Input", AspectRatioFixed->True], Cell[TextData[ "OtherVariables is a special symbol for AlgebraicRulesExtended: it is\n \ replaced by the sequence of those variables in eqns that are not in\n vars \ (arranged in default order). "], "Print", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["?ApplicationMethod"], "Input", AspectRatioFixed->True], Cell[TextData[ "ApplicationMethod is an option for AlgebraicRulesExtended and\n \ AlgebraicRulesExtendedData: \n ApplicationMethod -> 1, the default, is faster \ but less powerful than\n ApplicationMethod -> 2. \n \ Sin[a]^3/.AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]}] -->\n \ Sin[c]^3. \n Sin[a]^3/.AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]},\ \n ApplicationMethod -> 2] --> p Sin[c]. \nApplicationMethod can also be \ used when applying an\n AlgebraicRulesExtendedData object to an expression: \ \n ar = AlgebraicRulesExtended[{a==c, Sin[a]^2 == p},{Sin[a]}] \n \ ReplaceAll[Sin[a]^3, ar, ApplicationMethod -> 2] --> p Sin[c]. "], "Print", Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["?DivisorsUsed"], "Input", AspectRatioFixed->True], Cell[TextData[ "DivisorsUsed/.AlgebraicRulesExtendedData[...] gives the divisors used in\n \ constructing AlgebraicRulesExtendedData[...] (which must be\n non-zero). \n\ DivisorsUsed/.AlgebraicRulesExtended[a x == b x + 1,x] --> (a-b). "], "Print",\ Evaluatable->False, AspectRatioFixed->True]}, Open]], Cell[CellGroupData[{Cell[TextData["Options[AlgebraicRulesExtended]"], "Input", AspectRatioFixed->True], Cell[OutputFormData[ "\<\ {InverseFunctions -> Automatic, MakeRules -> True, Method -> 1, Mode -> Rational, Sort -> False, VerifySolutions -> False, WorkingPrecision -> DirectedInfinity[1], Heads -> False, ApplicationMethod -> 1}\ \>", "\<\ {InverseFunctions -> Automatic, MakeRules -> True, Method -> 1, Mode -> Rational, Sort -> False, VerifySolutions -> False, WorkingPrecision -> Infinity, Heads -> False, ApplicationMethod -> 1}\ \>"], "Output", Evaluatable->False, AspectRatioFixed->True]}, Open]]}, Open]]}, Open]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 640}, {0, 460}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 365}, WindowMargins->{{44, Automatic}, {15, Automatic}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ AVU/IFiQKFD000000V:^/09R]g0000000OVaH097bCP0AP1Y06`0I@1^0642HZj` 0V:gT0000001nK500TO9>000000000000000009R[[0000000000000000000000 00000000000000000000000000000000\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 97, 2, 70, "Title", Evaluatable->False], Cell[1831, 55, 108, 2, 70, "Subtitle", Evaluatable->False], Cell[1942, 59, 147, 4, 70, "Subsubtitle", Evaluatable->False], Cell[2092, 65, 78, 1, 70, "Input"], Cell[CellGroupData[{ Cell[2193, 68, 85, 2, 70, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[2301, 72, 133, 3, 70, "Subsubsection", Evaluatable->False], Cell[CellGroupData[{ Cell[2457, 77, 108, 2, 70, "Input"], Cell[2568, 81, 145, 7, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[2745, 90, 112, 2, 70, "Input"], Cell[2860, 94, 142, 7, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[3034, 103, 135, 3, 70, "Input"], Cell[3172, 108, 145, 7, 70, "Output", Evaluatable->False] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[3358, 117, 104, 2, 70, "Subsubsection", Evaluatable->False], Cell[CellGroupData[{ Cell[3485, 121, 88, 1, 70, "Input"], Cell[3576, 124, 110, 6, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[3718, 132, 103, 1, 70, "Input"], Cell[3824, 135, 110, 6, 70, "Output", Evaluatable->False] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[3975, 143, 108, 2, 70, "Subsubsection", Evaluatable->False], Cell[CellGroupData[{ Cell[4106, 147, 275, 9, 70, "Input"], Cell[4384, 158, 124, 7, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[4540, 167, 149, 3, 70, "Input"], Cell[4692, 172, 118, 6, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[4842, 180, 167, 3, 70, "Input"], Cell[5012, 185, 118, 6, 70, "Output", Evaluatable->False] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[5171, 193, 106, 2, 70, "Subsubsection", Evaluatable->False], Cell[CellGroupData[{ Cell[5300, 197, 132, 3, 70, "Input"], Cell[5435, 202, 110, 6, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[5577, 210, 117, 2, 70, "Input"], Cell[5697, 214, 1063, 39, 70, "Output", Evaluatable->False], Cell[6763, 255, 116, 6, 70, "Output", Evaluatable->False] }, Open ]] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[6929, 263, 91, 2, 70, "Section", Evaluatable->False], Cell[CellGroupData[{ Cell[7043, 267, 80, 1, 70, "Input"], Cell[7126, 270, 603, 10, 70, "Print", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[7761, 282, 76, 1, 70, "Input"], Cell[7840, 285, 2318, 33, 70, "Print", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[10190, 320, 68, 1, 70, "Input"], Cell[10261, 323, 259, 5, 70, "Print", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[10552, 330, 71, 1, 70, "Input"], Cell[10626, 333, 722, 11, 70, "Print", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[11380, 346, 66, 1, 70, "Input"], Cell[11449, 349, 303, 6, 70, "Print", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[11784, 357, 84, 1, 70, "Input"], Cell[11871, 360, 527, 19, 70, "Output", Evaluatable->False] }, Open ]] }, Closed]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)