1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

(Reals and Rationals): Use tex for sqrt2 and pi.

(Complex Numbers): Add polar form read syntax.
This commit is contained in:
Kevin Ryde 2005-02-17 21:18:31 +00:00
parent a115b0feaa
commit 34942993e6

View file

@ -494,7 +494,8 @@ all possible points along a continuous, infinite, one-dimensional line.
The rational numbers are the set of all numbers that can be written as
fractions @var{p}/@var{q}, where @var{p} and @var{q} are integers.
All rational numbers are also real, but there are real numbers that
are not rational, for example the square root of 2, and pi.
are not rational, for example @m{\sqrt2, the square root of 2}, and
@m{\pi,pi}.
Guile can represent both exact and inexact rational numbers, but it
can not represent irrational numbers. Exact rationals are represented
@ -665,6 +666,16 @@ the imaginary part.
9.3-17.5i
@end lisp
@cindex polar form
@noindent
Polar form can also be used, with an @samp{@@} between magnitude and
angle,
@lisp
1@@3.141592 @result{} -1.0 (approx)
-1@@1.57079 @result{} 0.0-1.0i (approx)
@end lisp
Guile represents a complex number with a non-zero imaginary part as a
pair of inexact rationals, so the real and imaginary parts of a
complex number have the same properties of inexactness and limited
@ -1038,6 +1049,7 @@ Return a complex number constructed of the given @var{real} and
@deffn {Scheme Procedure} make-polar x y
@deffnx {C Function} scm_make_polar (x, y)
@cindex polar form
Return the complex number @var{x} * e^(i * @var{y}).
@end deffn