Hello,
> > Well, what I see when I try to plot plot2d([sqrt(x-2) * sqrt(x-4)],
> > [x,-5,5]) is a piece for x <= 2, a gap, and a piece for x >= 4.
> > The x <= 2 piece is negative and the x >= 4 piece is positive,
> > but that seems to follow from the form of the expression -- for x < 2
> > sqrt(x - 2) * sqrt(x - 4) => product of pure imaginaries w/ i.p. > 0
> > so the final result is real and negative. That seems OK to me.
> > >The solution (but I do not know how to apply it to maxima) is to calculate
> > >the value of result_imaginary variable for every part of the equation.
> > >When the calc is started result_imaginary is set to 0.
> > >Whatever part of the function creates a complex number this variable must be
> > >set to 1 to flag that the equation is _not_ defined even if the imaginary part
> > >is zeroed before the end of the calc.
> > I'm not sure I understand, but this appears to be a proposal to treat
> > an expression as undefined for the purpose of plotting if any part of
> > it is complex.
> you are correct. Do you think is it possible to obtain this in any easy
> way?
Before we can discuss implementation, we should discuss the idea itself.
Obviously, it is not well-defined. Robert's example of adding +%i-%i
somewhere inside the formula shows this quite cleanly, but is somewhat
artificial. Let's consider another example. Suppose, I have an equation of
degree 4 which depends on a parameter. I want to plot real roots of this
equation as functions of the parameter. As everybody knows, real roots of
equations of degree 4 are often given by radical expressions with complex
intermediate results. Do they fail to be real roots? Why?? And if somebody
will be able to re-write the same expression in a form containing only
roots of positive sub-expressions, this solution will suddenly become
admissible. Is this so? I cannot believe.
So, I think that the proposal is (1) ill-defined; and (2) tries to replace
the correct behaviour by an incorrect one, and should not be implemented,
even if it can be done easily.
Andrey