This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

[Caml-list] complex numbers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: -- (:) From: Andrew Lenharth Subject: Re: [Caml-list] complex numbers
```Not that I know of, though you can define them yourself.

# let (+..) x y = add x y;;
val ( +.. ) : Complex.t -> Complex.t -> Complex.t = <fun>
# {re = 1.0; im = 1.0} +.. {re = 1.0; im = 1.0};;
- : Complex.t = {re = 2.; im = 2.}

Andrew Lenharth

On Fri, Feb 27, 2004 at 05:57:01PM +0300, Alexander Danilov wrote:
> Andrew Lenharth wrote:
>
> >open Complex;;
> >
> >let x = {re = 1.0; im = 1.0};;
> >
> >let y = mul x {re = -1.0; im = -1.0};;
> >
> >let z = norm2 y;;
> >
> >let a = norm x;;
> >
> >The rest of the functions are in the standard library Complex module
> >documentation.  This should be enough to get you started.
> >
> >Andrew Lenharth
> >
> >On Fri, Feb 27, 2004 at 09:04:01AM +0300, Alexander Danilov wrote:
> >
> >
> >>Please, show me an example how to work with complex numbers in Ocaml.
> >>I mean, how to create complex number, how to perform orepations (+ - *
> >>/) with complex numbers.
> >>Thanx.
> >>
> >>
> >>
> >
> Thank you.
> But what about infix operations for Complex numbers, I mean something
> like +.,-., /., ... exists for float
> numbers, any such operations defined  for complex number?
>

--
"It will work in practice, yes. But will it work in theory?"
--- a french diplomat's comment, recalled by Madeleine  Albright

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

```