Помогите сделать в Python
Ответы
from math import sin, cos, log
#1 в першій умові там виходять комплексні чисела, тому не через sqrt()
print(*[f"x = {3+0.25*i}{' '*int(6-len(str(3+0.25*i)))}y = {(4*sin(3+0.25*i)+cos(3+0.25*i)+1)**0.5}" for i in range(int((5-3)//0.25)+1)], sep="\n", end="\n\n")
#2
print(*[f"x = {15+0.3*i} y = {sin(log(15+0.3*i)) if 15+0.3*i < 16 else log(pow(sin(15+0.3*i) + 1, 2))}" for i in range(int((18-15)//0.3)+1)], sep="\n")
ВИВІД
перший:
x = 3.0 y = 0.7579495600889438
x = 3.25 y = (4.000821072186897e-17+0.6533836653919194j)
x = 3.5 y = (7.087070276966474e-17+1.157406410060561j)
x = 3.75 y = (8.887773705296851e-17+1.4514835969823896j)
x = 4.0 y = (1.0025762334639126e-16+1.6373312438524237j)
x = 4.25 y = (1.0651690565100134e-16+1.7395530813482314j)
x = 4.5 y = (1.0817375729512432e-16+1.766611522121139j)
x = 4.75 y = (1.0534043104065445e-16+1.720339792893699j)
x = 5.0 y = (9.781921241185571e-17+1.5975089712390749j)
другий:
x = 15.0 y = 0.4200881480289483
x = 15.3 y = 0.40203640401589014
x = 15.6 y = 0.3841820680789618
x = 15.9 y = 0.3665270504946918
x = 16.2 y = -1.278917062967086
x = 16.5 y = -2.4880994749545158
x = 16.8 y = -4.3707961779741185
x = 17.1 y = -8.27847530002225
x = 17.4 y = -9.828664070743375
x = 17.7 y = -4.874118426348815
x = 18.0 y = -2.7805023320891644
Ответ:
from math import sin, cos, log
#1 в першій умові там виходять комплексні чисела, тому не через sqrt()
print(*[f"x = {3+0.25*i}{' '*int(6-len(str(3+0.25*i)))}y = {(4*sin(3+0.25*i)+cos(3+0.25*i)+1)**0.5}" for i in range(int((5-3)//0.25)+1)], sep="\n", end="\n\n")
#2
print(*[f"x = {15+0.3*i} y = {sin(log(15+0.3*i)) if 15+0.3*i < 16 else log(pow(sin(15+0.3*i) + 1, 2))}" for i in range(int((18-15)//0.3)+1)], sep="\n")
ВИВІД
перший:
x = 3.0 y = 0.7579495600889438
x = 3.25 y = (4.000821072186897e-17+0.6533836653919194j)
x = 3.5 y = (7.087070276966474e-17+1.157406410060561j)
x = 3.75 y = (8.887773705296851e-17+1.4514835969823896j)
x = 4.0 y = (1.0025762334639126e-16+1.6373312438524237j)
x = 4.25 y = (1.0651690565100134e-16+1.7395530813482314j)
x = 4.5 y = (1.0817375729512432e-16+1.766611522121139j)
x = 4.75 y = (1.0534043104065445e-16+1.720339792893699j)
x = 5.0 y = (9.781921241185571e-17+1.5975089712390749j)
другий:
x = 15.0 y = 0.4200881480289483
x = 15.3 y = 0.40203640401589014
x = 15.6 y = 0.3841820680789618
x = 15.9 y = 0.3665270504946918
x = 16.2 y = -1.278917062967086
x = 16.5 y = -2.4880994749545158
x = 16.8 y = -4.3707961779741185
x = 17.1 y = -8.27847530002225
x = 17.4 y = -9.828664070743375
x = 17.7 y = -4.874118426348815
x = 18.0 y = -2.7805023320891644
Объяснение: