2022-07-19 18:48:52 +00:00
|
|
|
import {numComplex} from './Complex.mjs'
|
2022-07-19 18:16:29 +00:00
|
|
|
export const negate = {
|
2022-07-19 18:48:52 +00:00
|
|
|
/* need a "base case" to avoid infinite self-reference */
|
|
|
|
Complex: [['self'], ref => z => {
|
|
|
|
if (numComplex(z)) return {re: -z.re, im: -z.im}
|
|
|
|
return {re: ref.self(z.re), im: ref.self(z.im)}
|
|
|
|
}]
|
2022-07-19 18:16:29 +00:00
|
|
|
}
|