wrong graph



To elaborate a bit on "There is no good way to tell Maxima to do strictly
real arithmetic", you could of course define

     mysqrt(x):=if x<0 then error() else sqrt(x)$

which would work fine as a *computational* function, but it will not*simplify
* correctly in this case:

    mysqrt(x)/mysqrt(x) => 1

Also, mysqrt of a variable will expand out to a conditional, and your
expressions will tend to blow up, e.g.

   mysqrt(1+mysqrt(x));
       => if (if x < 0 then error() else sqrt(x)) + 1 < 0 then error()
                           else sqrt((if x < 0 then error() else sqrt(x)) +
1)

Maybe that is OK in your application....

If on the other hand you keep mysqrt as an unevaluated function, you'd have
to re-implement all the standard simplifications.

              -s

On Tue, Jan 3, 2012 at 13:35, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> Luigi,
>
> I tried your code, and got the following graph, which looks correct to me
> -- is that the graph you get?
>
> Though of course sqrt(-2) is not real, sqrt(-2)/sqrt(-1) is real.  There
> is no good way to tell Maxima to do strictly real arithmetic, such that
> (e.g.) sqrt(-1)/sqrt(-1) gives Undefined instead of 1.  Is that what you
> want?
>
>                 -s
>
> PS Please keep the Maxima mailing list CC'ed on discussions.
> [image: image.png]
>
> On Tue, Jan 3, 2012 at 02:09, Luigi Marino <luigi_marino2 at alice.it> wrote:
>
>> **
>> Hi Stravos
>> Maxima works in complex mode.
>> Look at my file.
>> I use the last Maxima release 5.21
>> Best.
>> Luigi
>>
>> ----- Original Message -----
>> *From:* Stavros Macrakis <macrakis at alum.mit.edu>
>> *To:* Luigi Marino <luigi_marino2 at alice.it>
>> *Cc:* maxima at math.utexas.edu
>> *Sent:* Tuesday, January 03, 2012 12:27 AM
>> *Subject:* Re: [Maxima] wrong graph
>>
>> For x>0 and x< -1, the result is real:
>>
>>  makelist(x*sqrt(x)/sqrt(1+x),x,[-1.5,-.5,.5,1.5]);
>> (%o69)         [- 2.598076211353316, - 0.5 %i, 0.28867513459481,
>> 1.161895003862225]
>>
>> For x>-1 and x< 0, the result is imaginary, and is not plotted, so there
>> is a gap in the plot.
>>
>> Is that what you are referring to?
>>
>>              -s
>>
>> PS For reports like this, please include the version number of Maxima,
>> the exact command you used to generate the result you think is incorrect,
>> and why you think it is incorrect.
>>
>>
>> On Sun, Jan 1, 2012 at 09:14, Luigi Marino <luigi_marino2 at alice.it>wrote:
>>
>>> **
>>> Maxima for a function with rational exponent
>>> plots not real parts.
>>>
>>> Example in the function:
>>>
>>> x*sqrt(x)/sqrt(1+x)
>>> or x^(3/2)/sqrt(1+x)
>>>
>>> the left part of the plot
>>> is not real ( x>0 for sqrt).
>>>
>>> Best wishes and Happy New Year
>>> Luigi Marino
>>>
>>>
>>> _______________________________________________
>>> Maxima mailing list
>>> Maxima at math.utexas.edu
>>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>>
>>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 10006 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120103/f01b300d/attachment.png>;