caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andrew Lenharth <alenhart@cs.ohiou.edu>
To: Alexander Danilov <alex@fssg.st-oskol.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] complex numbers
Date: Fri, 27 Feb 2004 10:36:21 -0500	[thread overview]
Message-ID: <20040227153621.GA1533@peuter> (raw)
In-Reply-To: <403F5ABD.1090402@fssg.st-oskol.ru>

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


  parent reply	other threads:[~2004-02-27 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  6:04 Alexander Danilov
2004-02-27 13:18 ` Andrew Lenharth
2004-02-27 16:36   ` Christophe TROESTLER
     [not found] ` <20040227131719.GA827@peuter>
     [not found]   ` <403F5ABD.1090402@fssg.st-oskol.ru>
2004-02-27 15:36     ` Andrew Lenharth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-09 10:59 [Caml-list] Complex Numbers David Gray
2003-04-09 11:53 ` sebastien FURIC
2001-03-28  2:19 David McClain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040227153621.GA1533@peuter \
    --to=alenhart@cs.ohiou.edu \
    --cc=alex@fssg.st-oskol.ru \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).