I am writing a code or a calculation of a very complicated function and my main variable is $x$ such that $-1<x<1$. This assumption has to simplify my final answer a lot, but since the final answer is very complicated (20-30 lines!), the FullSimplify condition does not return anything back and if I use the assumption at the end of the calculation, it again does not give anything back (it runs forever).

So, I have broken the calculation down to small bits, where in every small part I calculate a function of $x$. But, I do not want to re-evaluate the result of each function by re-writing the assumption $Abs[x]<1$. Is there a way to define $x$ at the start of the code such that whenever there is an $x$ is the code, Mathematica will take it to be such that $Abs[x]<1$? I.e., can I define $x$ with this condition globally?

  • $\begingroup$ Have you seen $Assumptions? (It will only be applied to functions that use assumptions.) $\endgroup$ – Michael E2 Aug 16 '18 at 15:22
  • $\begingroup$ I have always used it for simplifying a result. But, I do not know how to impose the assumptions globally (i.e. whenever the program sees $x$, it will know, before even doing the calculation that $Abs[x]<1$ and will simplify by itself the calculation based on the assumption). $\endgroup$ – TheQuantumMan Aug 16 '18 at 15:24
  • 1
    $\begingroup$ I don't have a clear idea what you're after. Some functions, such as Solve and Maximize, require the constraints to be explicitly listed. Strictly speaking, then, the answer to your question is "No." Some functions do no simplification, and $Assumptions will have no effect even if they could simplify the problem. Functions that call Simplify internally will apply $Assumptions when Simplify is called; there are other functions that use assumptions in the same way, also. $\endgroup$ – Michael E2 Aug 16 '18 at 15:35
  • $\begingroup$ @MichaelE2 Well, most of my functions are defined with respect to derivatives of $x$. But, when I get the results of these derivatives, there are simplifications that can be done when I use the assumption $Abs[x]<1$. My end result is a sum of these functions of derivatives. So, I do not want to use assumptions after the calculation of every function. I am just asking if there is a way for mathematica to know that whenever it finds $x$, it should assume that $Abs[x]<1$. $\endgroup$ – TheQuantumMan Aug 16 '18 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.