16 lines
379 B
Plaintext
16 lines
379 B
Plaintext
require "complex"
|
|
local fmt = require "fmt"
|
|
|
|
local x = new complex(1, 3)
|
|
local y = new complex(5, 2)
|
|
|
|
fmt.print("x = %s", x)
|
|
fmt.print("y = %s", y)
|
|
fmt.print("x + y = %s", x + y)
|
|
fmt.print("x - y = %s", x - y)
|
|
fmt.print("x * y = %s", x * y)
|
|
fmt.print("x / y = %s", x / y)
|
|
fmt.print("-x = %s", -x)
|
|
fmt.print("1 / x = %s", x:inverse())
|
|
fmt.print("x* = %s", x:conj())
|