Module:Rational: Difference between revisions
m Semiconvergent fix |
m A few norms implemented |
||
Line 658: | Line 658: | ||
end | end | ||
return max_factor | return max_factor | ||
end | |||
-- determine log2 product complexity | |||
function p.tenney_height(a) | |||
if type(a) == 'number' then | |||
a = p.new(a) | |||
end | |||
if a.nan or a.inf or a.zero then | |||
return nil | |||
end | |||
local n, m = p.as_pair(a) | |||
return math.log(n * m) / math.log(2) | |||
end | |||
-- determine max complexity | |||
function p.weil_height(a) | |||
if type(a) == 'number' then | |||
a = p.new(a) | |||
end | |||
if a.nan or a.inf or a.zero then | |||
return nil | |||
end | |||
local n, m = p.as_pair(a) | |||
return math.max(n, m) | |||
end | |||
-- determine product complexity | |||
function p.beneditti_height(a) | |||
if type(a) == 'number' then | |||
a = p.new(a) | |||
end | |||
if a.nan or a.inf or a.zero then | |||
return nil | |||
end | |||
local n, m = p.as_pair(a) | |||
return n * m | |||
end | end | ||