Created
May 25, 2014 03:46
-
-
Save goerz/e75aafc357919f6166b7 to your computer and use it in GitHub Desktop.
How to tell Mathematica that a variable represents a real number, is greater than zero, or similar conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(************** Content-type: application/mathematica ************** | |
CreatedBy='Mathematica 5.1' | |
Mathematica-Compatible Notebook | |
This notebook can be used with any Mathematica-compatible | |
application, such as Mathematica, MathReader or Publicon. The data | |
for the notebook starts with the line containing 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: [email protected] | |
phone: +1-217-398-0700 (U.S.) | |
Notebook reader applications are available free of charge from | |
Wolfram Research. | |
*******************************************************************) | |
(*CacheID: 232*) | |
(*NotebookFileLineBreakTest | |
NotebookFileLineBreakTest*) | |
(*NotebookOptionsPosition[ 4250, 174]*) | |
(*NotebookOutlinePosition[ 4901, 197]*) | |
(* CellTagsIndexPosition[ 4857, 193]*) | |
(*WindowFrame->Normal*) | |
Notebook[{ | |
Cell[CellGroupData[{ | |
Cell["Assumptions", "Title"], | |
Cell[TextData[{ | |
"How can I tell ", | |
StyleBox["Mathematica", | |
FontSlant->"Italic"], | |
" that a variable represents a real number, is greater than zero, or \ | |
simmilar things?" | |
}], "Text"], | |
Cell[TextData[{ | |
"Certain commands such as ", | |
StyleBox["Integrate", | |
FontSlant->"Italic"], | |
", ", | |
StyleBox["Simplify", | |
FontSlant->"Italic"], | |
", etc. use the environment variable ", | |
StyleBox["$Assumptions", | |
FontSlant->"Italic"], | |
" to get information on the variables used in the expression. By default \ | |
is" | |
}], "Text"], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\($Assumptions\)], "Input"], | |
Cell[BoxData[ | |
\(True\)], "Output"] | |
}, Open ]], | |
Cell[TextData[{ | |
"For single commands one can use ", | |
StyleBox["Assuming", | |
FontSlant->"Italic"], | |
", this modifies ", | |
StyleBox["$Assumptions", | |
FontSlant->"Italic"], | |
" temporarily, i.e. only for this single expression.\nThe option ", | |
StyleBox["Assumptions", | |
FontSlant->"Italic"], | |
" of ", | |
StyleBox["Integrate", | |
FontSlant->"Italic"], | |
" is similar, it points to ", | |
Cell[BoxData[ | |
FormBox[ | |
StyleBox["$Assumptions", | |
FontSlant->"Italic"], TraditionalForm]]], | |
" by default but can be changed to any set of assumptions.\nTo modify the \ | |
assumptions not just temporarily for one command, you can write directly to \ | |
the environment variable.\n\nExample:" | |
}], "Text"], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\(f = \@x\^2\/x // FullSimplify\)], "Input"], | |
Cell[BoxData[ | |
\(x\/\@x\^2\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\($Assumptions = \((x\ \[Element] \ Reals)\)\)], "Input"], | |
Cell[BoxData[ | |
\(x \[Element] Reals\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\(f // FullSimplify\)], "Input"], | |
Cell[BoxData[ | |
\(Sign[x]\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\($Assumptions\ = \((x\ > \ 0)\)\)], "Input"], | |
Cell[BoxData[ | |
\(x > 0\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\(f // FullSimplify\)], "Input"], | |
Cell[BoxData[ | |
\(1\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\($Assumptions\ = \ $Assumptions\ && \ \((x\ \[Element] \ | |
Reals)\)\)], "Input"], | |
Cell[BoxData[ | |
\(x > 0 && x \[Element] Reals\)], "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[BoxData[ | |
\(f // FullSimplify\)], "Input"], | |
Cell[BoxData[ | |
\(1\)], "Output"] | |
}, Open ]] | |
}, Open ]] | |
}, | |
FrontEndVersion->"5.1 for X", | |
ScreenRectangle->{{0, 1024}, {0, 768}}, | |
WindowToolbars->{}, | |
WindowSize->{520, 600}, | |
WindowMargins->{{179, Automatic}, {-35, Automatic}} | |
] | |
(******************************************************************* | |
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[1776, 53, 28, 0, 98, "Title"], | |
Cell[1807, 55, 191, 6, 50, "Text"], | |
Cell[2001, 63, 341, 12, 68, "Text"], | |
Cell[CellGroupData[{ | |
Cell[2367, 79, 45, 1, 27, "Input"], | |
Cell[2415, 82, 38, 1, 27, "Output"] | |
}, Open ]], | |
Cell[2468, 86, 714, 21, 158, "Text"], | |
Cell[CellGroupData[{ | |
Cell[3207, 111, 62, 1, 48, "Input"], | |
Cell[3272, 114, 43, 1, 51, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[3352, 120, 76, 1, 27, "Input"], | |
Cell[3431, 123, 52, 1, 27, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[3520, 129, 50, 1, 27, "Input"], | |
Cell[3573, 132, 41, 1, 27, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[3651, 138, 65, 1, 27, "Input"], | |
Cell[3719, 141, 39, 1, 27, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[3795, 147, 50, 1, 27, "Input"], | |
Cell[3848, 150, 35, 1, 27, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[3920, 156, 113, 2, 27, "Input"], | |
Cell[4036, 160, 61, 1, 27, "Output"] | |
}, Open ]], | |
Cell[CellGroupData[{ | |
Cell[4134, 166, 50, 1, 27, "Input"], | |
Cell[4187, 169, 35, 1, 27, "Output"] | |
}, Open ]] | |
}, Open ]] | |
} | |
] | |
*) | |
(******************************************************************* | |
End of Mathematica Notebook file. | |
*******************************************************************) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment