Data update

This commit is contained in:
Ingy döt Net 2024-11-04 20:28:54 -08:00
parent 52a6ef48dd
commit 157b70a810
604 changed files with 14253 additions and 2100 deletions

View file

@ -1,15 +1,23 @@
(* Signature for complex numbers *)
signature COMPLEX = sig
type num
type num
val complex : real * real -> num
(* creation *)
val complex : real * real -> num
val negative : num -> num
val plus : num -> num -> num
val minus : num -> num -> num
val times : num -> num -> num
val invert : num -> num
val print_number : num -> unit
(* operations *)
val negative : num -> num
val plus : num -> num -> num
val minus : num -> num -> num
val times : num -> num -> num
val invert : num -> num
(* polar form *)
val abs : num -> real
val arg : num -> real
(* output *)
val print_number : num -> unit
end;
(* Actual implementation *)
@ -29,6 +37,9 @@ structure Complex :> COMPLEX = struct
(a / denom, ~b / denom)
end
fun abs (x, y) = Math.sqrt (x*x + y*y)
fun arg (x, y) = Math.atan2(y, x)
fun print_number (a, b) =
print (Real.toString(a) ^ " + " ^ Real.toString(b) ^ "i\n")
end;