On Dec 29, 8:55 am, ggrafendorfer <georg.grafendor...@gmail.com>
wrote:
Hi Georg,
> > You should do it the right way instead of the wrong way. It is a very
> > bad idea to do stuff like "ln(CC(-5).n(prec=100))", which basically
> > says "take -5, think of it as a complex number with 53 bits of
> > precision, take the log, then view the answer as magically having 100
> > bits of precision by basically randomly making up the missing 47
> > bits".
>
> Dear William,
> With "ln(CC(-5).n(prec=100))" I'm not taking the log of a number with
> 53-bit precision hoping that it magically turns into a 100-bit
> precision number, what you mean would be "ln(CC(-5)).n(prec=100)",
> I'm taking the log of CC(-5).n(prec=100) which obviously should be a
> 100-bit precision number,
Look at "CC?" - the CC field is 53 bits of precision. If you want more
looks at ComplexField?
> But the main question actually was if it's a desired behauviour that CC
> (-5).n(prec=100) is a real number:
>
> sage: type(CC(-5).n(prec=100))
> <type 'sage.rings.real_mpfr.RealNumber'>
>
> increasing precision of a complex number should not change it's type,
> or?
Well, you are asking for a numerical approximation here of "-5" in the
complex field. I am not sure this is a bug when the value is returned
in the "smaller" field.
> Georg
I am not 100% sure we are actually trying to solve the same issue:
This is what you get:
sage: a = CC(1/3).n(prec=200)
sage: a
0.33333333333333300000000000000000000000000000000000000000000
and the precision is not 200 correct bits, but 53 correct bits and
zeroes filled in. This is the point William was trying to make AFAIK.
What you might want is this:
sage: b=ComplexField(200)
sage: b
Complex Field with 200 bits of precision
sage: b=1/3;b
1/3
sage: b.n(prec=200)
0.33333333333333333333333333333333333333333333333333333333333
In the above case you get 200 bits of precision.
Cheers,
Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---