Created
April 21, 2024 11:16
-
-
Save lastforkbender/079a079cfb9900afef35223abd99e8c1 to your computer and use it in GitHub Desktop.
Calculates a curvature median across a pos-shift returns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PYTHON FUNCTION, VGER: | |
| # Returns two numbers as a -string- from reversed pos-shift tolerance depths. | |
| # If median lengths extend beyond any cache limits(c) then can return 'vger'. | |
| #_______________________________________________________________________________________ | |
| def vger(self, v, m, c, d): | |
| # EXAMPLE: vger(5, 999, [1,11,2,22,3,33,4,44,5,55,6,66,7,77,8,88,9,99], 120) | |
| w = None | |
| top = [v] | |
| alpha = [] | |
| pvtIdx = 0 | |
| mdnLen = 0 | |
| A = [random.randint(10,99) for _ in range(9999)] | |
| lwr = [random.randint(100,999) for _ in range(9999)] | |
| beta = [random.randint(1000,9999) for _ in range(9999)] | |
| for i in range(9999): | |
| w = A[top[pvtIdx]] | |
| for j in lwr: | |
| w-=j*A[j] | |
| w /= beta[pvtIdx] | |
| if j > A[random.randint(1111,9999)]: | |
| break | |
| alpha.append((w, top[pvtIdx])) | |
| top.append(w+w) | |
| pvtIdx+=1 | |
| if pvtIdx <= d and pvtIdx >= len(top)-d: | |
| mdnLen = math.ceil(math.sqrt((len(top)-pvtIdx)//2)*w/w) | |
| if top[pvtIdx-d:pvtIdx][mdnLen] != top[pvtIdx:pvtIdx+mdnLen][::-1]: | |
| if pvtIdx-d >= w or top[pvtIdx] >= top[pvtIdx+mdnLen-1]: | |
| mdnLen+=1 | |
| d = d/w | |
| if mdnLen < w: | |
| c[mdnLen] = [] | |
| c.append((top[math.floor(pvtIdx-w):math.floor(pvtIdx+w)])) | |
| for j in range(math.ceil(d)): | |
| lwr[math.floor(pvtIdx-j/w)] = top[math.floor(pvtIdx+j/w)] | |
| pvtIdx+=d | |
| w = math.tan(math.ceil((math.sqrt(mdnLen*pvtIdx))+w)*c[math.ceil(pvtIdx)]) | |
| m = 0 | |
| A = None | |
| alpha = None | |
| top = True | |
| lwr = 0 | |
| beta = [] | |
| while True: | |
| try: | |
| lwr+=1 | |
| w = math.tan(math.sqrt(mdnLen-pvtIdx))*math.sqrt(c[math.floor(pvtIdx+mdnLen-w)]) | |
| if top: | |
| top = False | |
| alpha = w | |
| A = str(w).replace('0.','').replace('0.0','').replace('0.00','').replace('0.00','') | |
| beta.append(f'{A}-') | |
| else: | |
| if w != alpha: | |
| A = str(w).replace('0.','').replace('0.0','').replace('0.00','').replace('0.00','') | |
| beta.append(A) | |
| w = ''.join(beta) | |
| break | |
| elif lwr > 9999: | |
| return 'vger=/^~●<' | |
| except Exception as e: | |
| if lwr > 9999: | |
| return 'vger=/^~○<' | |
| pass | |
| return w | |
| #_______________________________________________________________________________________ | |
| #_______________________________________________________________________________________ |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
m-d/v = pvt