当前位置:网站首页>[first song] rebirth of me in py introductory training (2): formula programming
[first song] rebirth of me in py introductory training (2): formula programming
2022-07-27 06:05:00 【Collapse an old face】
It's not easy to create , Before reference , Point a praise , Collection , You can't pay too much attention , Family
The first 1 Turn off : Expression solving - Calculation of the position of the small ball thrown vertically
The task of this level takes the calculation of the position of throwing the ball vertically as an example , Pay attention to how to convert mathematical calculation formula into Python Expression and evaluate . Students should read relevant knowledge carefully , Find the mathematical operators and Python Correspondence between numeric operators , Complete the programming task and output the result of formula calculation .
# Please add the implementation code here #
# ********** Begin *********#
v=v0-g*th=v0*t-1/2*g*t*t
print(h)
# ********** End **********#The first 2 Turn off : Output format control - Celsius - Fahrenheit temperature conversion
When we calculate mathematical formulas , The result of calculation often has infinite decimals , such as 34.333333..., In the face of this situation , We usually keep the significant numbers after the decimal point to make the results more concise and beautiful .
The task of this pass is expressed in centigrade - Take Fahrenheit temperature conversion as an example , Pay close attention to Python How to control the output of formatted strings .
# Please add the implementation code here #
# ********** Begin *********#
c=(F-32)*5/9
F=('%.2f' % F)
c=('%.2f' % c)
str=' Fahrenheit {} degree = Celsius {} degree '.format(F,c)
print(str)
# ********** End **********#The first 3 Turn off : The use of library functions - Ball resistance falling motion
# Please add the implementation code here #
# ********** Begin *********#
import math
v=math.sqrt(m*g/u)*math.tanh(t*math.sqrt(u*g/m))
x=m/u*math.log(math.cosh(math.sqrt(u*g/m)*t))
v=('%.2f' % v)x=('%.2f' % x)
str1=' When t={} seconds , Speed v={} rice / second '.format(t,v)
str2='{} Seconds later , The position of the ball is downward {} rice '.format(t,x)
print(str1)print(str2)
# ********** End **********#The first 4 Turn off : Comprehensive application - Oblique upward throwing of small ball
This task requires the comprehensive application of the knowledge and technology in the previous training tasks , Find the distance that the ball moves in the vertical direction when it is thrown obliquely .
# Please add the implementation code here #
# ********** Begin *********#
import math
t=math.pi/180*thetav0=25/3.6
g=9.8
y0=1
x=0.5
y=x*math.tanh(t)-((1/(2*v0))*((g*(x**2)/((math.cosh(t)**2)))+y0
print('y The value is calculated as :{} rice '.format(y))
# ********** End **********#notes : The content is only for reference and sharing , Do not spread without permission , Tort made delete
边栏推荐
- [MVC Architecture] MVC model
- 9. High order operation
- Gbase 8C - SQL reference 6 SQL syntax (7)
- Gbase 8C - SQL reference 6 SQL syntax (3)
- 18. Convolutional neural network
- AE 3D粒子系统插件:Trapcode Particular
- Unittest套件与运行器
- 为什么交叉熵损失可以用于刻画损失
- Weidongshan digital photo frame project learning (I) display ASCII characters on LCD
- SoK: The Faults in our ASRs: An Overview of Attacks against Automatic Speech Recognition (题目过长)阅读笔记
猜你喜欢

2022.6.10 stm32mp157 serial port clock learning

【11】二进制编码:“手持两把锟斤拷,口中疾呼烫烫烫”?

A photo breaks through the face recognition system: you can nod your head and open your mouth, netizens

What has been updated in the Chinese version of XMIND mind map 2022 v12.0.3?

geonode geoserver win10 安装教程(亲测)

物联网操作系统多任务基础

Stm32-fsmc extended memory SRAM

数字图像处理 第二章 数字图像基础

导数、偏导数以及梯度

19. Up and down sampling and batchnorm
随机推荐
Super remote connection management tool: Royal TSX
pytorch转onnx相关问题
2. Simple regression problem
导数、偏导数以及梯度
芯片、存储器及其关键指标简述 一
[Haowen planting grass] knowledge of root domain name - Ruan Yifeng's Weblog
7. Merger and division
pytorch使用data_prefetcher提升数据读取速度
PS 2022 updated in June, what new functions have been added
能替代ps的修图软件?
【头歌】重生之数据科学导论——回归进阶
When multiple formulas in latex share a sequence number
Baiwen driving Daquan learning (II) I2C driving
Lightroom Classic 2022 v11.4中文版「最新资源」
Stm32-fsmc extended memory SRAM
4. Tensor data type and creation tensor
判断是否为回文结构的三种方法
Gbase 8C - SQL reference 6 SQL syntax (12)
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
根据SQL必知必会学习SQL(MYSQL)