def getSunrise_Sunset(lat, lon): year = datetime.datetime.now().year month = datetime.datetime.now().month day = datetime.datetime.now().day dst = time.localtime().tm_isdst if dst == 0: offset = -time.timezone/60 else: offset = -time.altzone/60 localtime = 12.00 b2 = float(lat) b3 = float(lon) b4 = dst b5 = localtime / 24 b6 = year d30 = getDayNumber(year, month, day) e30 = b5 f30 = d30 + 2415018.5 + e30 - b4 / 24 g30 = (f30 - 2451545) / 36525 q30 = 23 + (26 + ((21.448 - g30 * (46.815 + g30 * (0.00059 - g30 * 0.001813)))) / 60) / 60 r30 = q30 + 0.00256 * cos(radians(125.04 - 1934.136 * g30)) j30 = 357.52911 + g30 * (35999.05029 - 0.0001537 * g30) k30 = 0.016708634 - g30 * (0.000042037 + 0.0000001267 * g30) l30 = sin(radians(j30)) * (1.914602 - g30 * (0.004817 + 0.000014 * g30)) + sin(radians(2 * j30)) * (0.019993 - 0.000101 * g30) + sin(radians(3 * j30)) * 0.000289 i30 = mod(280.46646 + g30 * (36000.76983 + g30 * 0.0003032), 360) m30 = i30 + l30 p30 = m30 - 0.00569 - 0.00478 * sin(radians(125.04 - 1934.136 * g30)) t30 = degrees(arcsin(sin(radians(r30)) * sin(radians(p30)))) u30 = tg(radians(r30 / 2)) * tg(radians(r30 / 2)) v30 = 4 * degrees(u30 * sin(2 * radians(i30)) - 2 * k30 * sin(radians(j30)) + 4 * k30 * u30 * sin(radians(j30)) * cos(2 * radians(i30)) - 0.5 * u30 * u30 * sin(4 * radians(i30)) - 1.25 * k30 * k30 * sin(2 * radians(j30))) w30 = degrees(arccos(cos(radians(90.833)) / (cos(radians(b2)) * cos(radians(t30))) - tg(radians(b2)) * tg(radians(t30)))) x30 = (720 - 4 * b3 - v30 + offset) / 1440 x30 = (720 - 4 * b3 - v30 + offset) / 1440 y30 = (x30 * 1440 - w30 * 4) / 1440 z30 = (x30 * 1440 + w30 * 4) / 1440 sunrise = y30 * 24 sunset = z30 * 24 status = 0 tDate = "{0:04d}-{1:02d}-{2:02d} " . format(year, month, day) sr = tDate + getHHMMSS(sunrise) ss = tDate + getHHMMSS(sunset) return {'sunrise': sr, 'sunset': ss, 'status': status}
def f13(n): sum1 = sum2 = 0 for i in range(1, n + 1): sum1 += ln(pow(i, 7) + pow(i, 8)) - tg(i) for i in range(1, n + 1): sum2 += pow(i, 3) + pow(i, 4) return scientific(sum1 / 25 + sum2)
def f13(x,y): if x < 160: ans = (x ** 8) - (x ** 7) elif 160 <= x < 193: ans = math.tg((x ** 3 - x ** 4 - 75) + 5 * x ** 5 - 77) elif 193 <= x < 262: ans = (11 * (x ** 7)) - (21 * (x ** 6)) elif x >= 262: ans = (42*((x ** 5 + x * 8 + 55) ** 7) - 71 * (x ** 3))
def getSunriseAndSunset(lat, lon, dst, year, month, day): localtime = 12.00 b2 = lat b3 = lon b4 = dst b5 = localtime / 24 b6 = year d30 = getDayNumber(year, month, day) e30 = b5 f30 = d30 + 2415018.5 + e30 - b4 / 24 g30 = (f30 - 2451545) / 36525 q30 = 23 + (26 + ((21.448 - g30 * (46.815 + g30 * (0.00059 - g30 * 0.001813)))) / 60) / 60 r30 = q30 + 0.00256 * cos(radians(125.04 - 1934.136 * g30)) j30 = 357.52911 + g30 * (35999.05029 - 0.0001537 * g30) k30 = 0.016708634 - g30 * (0.000042037 + 0.0000001267 * g30) l30 = sin(radians(j30)) * ( 1.914602 - g30 * (0.004817 + 0.000014 * g30)) + sin(radians(2 * j30)) * ( 0.019993 - 0.000101 * g30) + sin(radians(3 * j30)) * 0.000289 i30 = mod(280.46646 + g30 * (36000.76983 + g30 * 0.0003032), 360) m30 = i30 + l30 p30 = m30 - 0.00569 - 0.00478 * sin(radians(125.04 - 1934.136 * g30)) t30 = degrees(arcsin(sin(radians(r30)) * sin(radians(p30)))) u30 = tg(radians(r30 / 2)) * tg(radians(r30 / 2)) v30 = 4 * degrees(u30 * sin(2 * radians(i30)) - 2 * k30 * sin(radians(j30)) + 4 * k30 * u30 * sin(radians(j30)) * cos(2 * radians(i30)) - 0.5 * u30 * u30 * sin(4 * radians(i30)) - 1.25 * k30 * k30 * sin(2 * radians(j30))) w30 = degrees( arccos( cos(radians(90.833)) / (cos(radians(b2)) * cos(radians(t30))) - tg(radians(b2)) * tg(radians(t30)))) x30 = (720 - 4 * b3 - v30 + b4 * 60) / 1440 x30 = (720 - 4 * b3 - v30 + b4 * 60) / 1440 y30 = (x30 * 1440 - w30 * 4) / 1440 z30 = (x30 * 1440 + w30 * 4) / 1440 sunrise = y30 * 24 sunset = z30 * 24 return (sunrise, sunset)
def calculator(b, range_num): #функция вычислителя for x in range(range_num + 1): #компенсируем невхождение последнего числа в ряд if x: # если x не равен нулю (не False) z = tg(b * x * x) / x #считаем z printer(z, x) #передаем в функцию печати
def tg(x): return math.tg(x)