1

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 π OppC[α]^2)/VolS[α]) + (2^(1/3) l^2 π^2 OppC[α]^4)/(VolS[α] (-2 l^3 π^3 OppC[α]^6 + 
  27 v VolS[α]^2 + 3 Sqrt[3]Sqrt[-4 l^3 π^3 v OppC[α]^6 VolS[α]^2 + 
  27 v^2 VolS[α]^4])^(1/3)) + 1/(2^(1/3)VolS[α]) (-2 l^3 π^3 OppC[α]^6 + 
  27 v VolS[α]^2 + 3 Sqrt[3]Sqrt[-4 l^3 π^3 v OppC[α]^6 VolS[α]^2 + 27 v^2 VolS[α]^4])^(1/3));

Then I want to Plot R1:

Plot3D[R1[α, l], {α, 0, 0.5*π}, {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?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
user7122
  • 41
  • 2

0 Answers0