MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / div

Method div

__test__/theorem.js:1897–1919  ·  view source on GitHub ↗
(complex)

Source from the content-addressed store, hash-verified

1895 return this.times(...arguments)
1896 }
1897 div(complex) {
1898 if (!complex.isComplex) {
1899 throw "[TheoremJS]: Complex operation require complex numbers"
1900 }
1901
1902 const a = this.a
1903 const b = this.b
1904 const c = complex.a
1905 const d = complex.b
1906
1907 const c2d2 = c.times(c).plus(d.times(d)) // c^2 + d^2
1908
1909 const acbd = a.times(c).plus(b.times(d)) // a*c + b*d
1910 const bcad = b.times(c).minus(a.times(d)) // b*c - a*d
1911
1912 const re = acbd.div(c2d2)
1913 const im = bcad.div(c2d2)
1914
1915 this.a = re
1916 this.b = im
1917
1918 return this
1919 }
1920 equal() {
1921 return this.eq(...arguments)
1922 }

Callers 15

toDec.jsFile · 0.80
time.jsFile · 0.80
volume.jsFile · 0.80
length.jsFile · 0.80
temperature.jsFile · 0.80
area.jsFile · 0.80
mass.jsFile · 0.80
speed.jsFile · 0.80
slope.jsFile · 0.80
log.jsFile · 0.80
ln.jsFile · 0.80
div.jsFile · 0.80

Calls 3

plusMethod · 0.80
timesMethod · 0.80
minusMethod · 0.80

Tested by

no test coverage detected