File: ex5.ml

package info (click to toggle)
ocaml-gnuplot 0.8.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 508 kB
  • sloc: ml: 2,148; makefile: 185
file content (25 lines) | stat: -rw-r--r-- 641 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(* 	$Id: ex5.ml,v 1.2 2004-11-22 19:54:26 chris_77 Exp $	 *)

module P = Gnuplot
open Parse_args

let () =
  let f u v =
    let r = sqrt(u *. u +. v *. v) in sin(r) /. r in
  let g = P.init ?offline:(offline 1) (device 1) in
  P.box3 g;
  P.fxy g f (-10.) 10. (-10.) 10.;
  P.close g

let () =
  let sq t = t *. t in
  let f x y =
    let x2 = x *. x
    and y2 = y *. y in
    3. *. sq(1. -. x) *. exp(-. x2 -. sq(y +. 1.)) -.
      10. *. (x/.5. -. x**3. -. y**5.) *. exp(-. x2 -. y2) -.
      exp(-. sq(x+.1.) -. y2) /. 3. in
  let g = P.init ?offline:(offline 2) (device 2) in
  P.box3 g;
  P.fxy g f (-2.5) 2.5 (-2.5) 2.5;
  P.close g