Python Optimization and Bizarre Output Responses -


i have 2 small issues regarding code in python 2.7, , see input on these issues:

lesser issue: i've been testing python 2.7 script designed output degree heading after given distance traveled around ellipse. however, need program run within 15 seconds full extent. currently, program outputs 31.1410000324 seconds completion isn't terrible considering possible me divide sample size little less half.

main issue: however, here other problem: @ 3 specific points in program, result being output not correct. 1 time outputs 18.47700786, , other 2 output 37.90802974. why happening? when run 3 of them normally, output correct values, @ full speed, appear give strange values though values consistent every time. know think.

here script:

import numpy np scipy.integrate import quad scipy.optimize import minimize import time = 2; b = 1 dx = lambda t: -a * np.sin(t) dy = lambda t: b * np.cos(t)  encoderdistance = 0.00001 def func(x): return np.sqrt(dx(x)**2 + dy(x)**2) time1 = time.time() in range(2423):     r_angle = (((180/np.pi) * np.arctan(((np.tan(minimize(lambda x:                   abs(quad(func, 0, x)[0] - encoderdistance), 1).x))*b)/a)))     print r_angle[0]     encoderdistance += 0.001 time2 = time.time() print time2-time1, "seconds completion" 

and here graph of output code: code graph


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -