Skip to content

Instantly share code, notes, and snippets.

@lucas-clemente
Created March 26, 2014 12:30
Show Gist options
  • Select an option

  • Save lucas-clemente/9782063 to your computer and use it in GitHub Desktop.

Select an option

Save lucas-clemente/9782063 to your computer and use it in GitHub Desktop.
(* ::Package:: *)
BeginPackage["SimpleAssume`"]
Unprotect @@ Names["SimpleAssume`*"];
ClearAll @@ Names["SimpleAssume`*"];
$Assumptions={}
AssumeReal::usage = "assume variables to be real";
AssumeRealPositive::usage = "assume variables to be real and positive";
Begin["`Private`"]
AssumeReal[vars__] :=
$Assumptions = Join[$Assumptions, # \[Element] Reals & /@ {vars}];
AssumeRealPositive[vars__] :=
$Assumptions = Join[$Assumptions, Flatten[{# \[Element] Reals, # > 0} & /@ {vars}]];
Protect @@ Names["SimpleAssume`*"];
End[]
EndPackage[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment