# How can I say that all quantities need to be positive (and real)?

Can you say at the beginning of a script in mathematica that you want all the quantities to be positive (and real)? So that in all calculations, only the real values of these quantities will be considered (by calculations and by plotting) I want to do this because I want to optimize a free energy by finding the best length quantities. But then I will find answers with negative or imaginary length quantities.Also when I make a 3Dplot of the free energy as a function of two of these quantities, mathematica plot the imaginary values.

Update:

An example is:

R1 is defined as followed:

R1[a_,l_] = 1/3 (-((l \[Pi] OppC[\[Alpha]]^2)/VolS[\[Alpha]]) + (2^(1/3) l^2 \[Pi]^2 OppC[\[Alpha]]^4)/(VolS[\[Alpha]] (-2 l^3 \\[Pi]^3 OppC[\[Alpha]]^6 + 27 v VolS[\[Alpha]]^2 + 3 Sqrt[3]Sqrt[-4 l^3 \[Pi]^3 v OppC[\[Alpha]]^6 VolS[\[Alpha]]^2 + 27 v^2 VolS[\[Alpha]]^4])^(1/3)) + 1/(2^(1/3)VolS[\[Alpha]]) (-2 l^3 \[Pi]^3 OppC[\[Alpha]]^6 + 27 v VolS[\[Alpha]]^2 + 3 Sqrt[3]Sqrt[-4 l^3 \[Pi]^3 v OppC[\[Alpha]]^6 VolS[\[Alpha]]^2 + 27 v^2 VolS[\[Alpha]]^4])^(1/3));


Then I want to Plot R1:

Plot3D[R1[\[Alpha], l], {\[Alpha], 0, 0.5*\[Pi]}, {l, 0, 10}].


But by plotting, also imaginary values of R1 are plotted. What do I have to do that mathematica does not plot these values?

-
You've seen Assuming[]? –  Ｊ. Ｍ. May 22 at 14:51
Once upon a time there was the RealOnly package for this but it hasn't been maintained. IIRC it did more than Assuming does, but I may be mistaken. –  Mr.Wizard May 22 at 15:04
do you mean assume real or do you mean always take the real part? A specific example would be helpful. –  george2079 May 22 at 15:24
@J.M. In the context of this question using \$Assumptions may be better. –  Sjoerd C. de Vries May 22 at 15:35
If you install and then load RealOnly.m, you'll see the message: "The RealOnly package is obsolete. Use instead functionality provided by Reduce[equations, variables, Reals] and by Assuming, Refine, and similar functions." –  murray May 22 at 22:00