All problems
Multifractal Width Lite
Problem
Estimate multifractal width as the gap between two scaling exponents. Let d1 be absolute one-step changes and d2 absolute two-step changes; compute H1 = log2(mean(d2) / mean(d1)) and H2 = log2(rms(d2) / rms(d1)); return abs(H1 - H2).
Return 0.0 when there are fewer than three points or a denominator is zero.
Hint
A monofractal signal gives nearly equal exponents, so the width is near zero.
Test cases
case 1
in: [[1,2,3,4,5]]
expected: 0
case 2
in: [[1,1,1,2,10]]
expected: 0.19192974728965728
case 3
in: [[1,2,4,8,16]]
expected: 0.11651983276797817
case 4
in: [[3,3,3,3]]
expected: 0
Starter codePython
import math
def multifractal_width_lite(series):
# Your code here
pass4 test cases · run your code against them in the editor