当前位置:网站首页>【头歌】重生之我在py入门实训中(2):公式编程
【头歌】重生之我在py入门实训中(2):公式编程
2022-07-27 05:19:00 【垮起个老脸】
创作不易,参考之前,点个赞,收藏,关注一下不过分吧,家人们
第1关:表达式求解 - 垂直上抛小球位置计算
本关任务以垂直上抛小球的位置计算为例,关注如何将数学计算公式转换为Python表达式并求值。学生需仔细阅读相关知识,找到数学运算符与Python数值运算符之间的对应关系,完成编程任务并输出公式计算的结果。
# 请在此添加实现代码 #
# ********** Begin *********#
v=v0-g*th=v0*t-1/2*g*t*t
print(h)
# ********** End **********#第2关:输出格式控制 - 摄氏-华氏温度换算
我们在计算数学公式时,计算结果很多时候都带有无穷小数,比如34.333333...,面对这种情况,我们一般通过保留小数点后面的有效数字来让结果更加简洁美观。
本关任务以摄氏-华氏温度换算为例,关注在Python中如何控制输出格式化的字符串。
# 请在此添加实现代码 #
# ********** Begin *********#
c=(F-32)*5/9
F=('%.2f' % F)
c=('%.2f' % c)
str='华氏{}度=摄氏{}度'.format(F,c)
print(str)
# ********** End **********#第3关:库函数的使用 - 小球阻力落体运动
# 请在此添加实现代码 #
# ********** 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='当t={}秒时,速度v={}米/秒'.format(t,v)
str2='{}秒后,小球位置为向下{}米'.format(t,x)
print(str1)print(str2)
# ********** End **********#第4关:综合应用 - 小球斜上抛运动
本关任务要求综合应用前面几个实训任务中的知识和技术,求小球斜上抛运动时垂直方向移动的距离。
# 请在此添加实现代码 #
# ********** 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值计算结果为:{}米'.format(y))
# ********** End **********#注:内容只做参考和分享,未经允许不可传播,侵权立删
边栏推荐
- 3. Classification problems - initial experience of handwritten digit recognition
- Day 17.The role of news sentiment in oil futures returns and volatility forecasting
- 【Unity URP】代码获取当前URP配置UniversalRendererData,并动态添加RendererFeature
- Day 11. Evidence for a mental health crisis in graduate education
- Day 9. Graduate survey: A love–hurt relationship
- Day 15. Deep learning radiomics can predict axillary lymphnode status in early-stage breast cancer
- 8. Mathematical operation and attribute statistics
- 13.逻辑回归
- 数字图像处理 第八章——图像压缩
- Day10. Work organization and mental health problems in PhD students
猜你喜欢

维度问题以及等高线

11. Gradient derivation of perceptron

1.PyTorch简介

新冠时空分析——Global evidence of expressed sentiment alterations during the COVID-19 pandemic

Social media user level psychological stress detection based on deep neural network

Digital image processing Chapter 8 - image compression

18.卷积神经网络

7. Merger and division

Day14. Using interpretable machine learning method to distinguish intestinal tuberculosis and Crohn's disease

15.GPU加速、minist测试实战和visdom可视化
随机推荐
Global evidence of expressed sentimental alterations during the covid-19 pandemics
【MVC架构】MVC模型
【并发编程系列9】阻塞队列之PriorityBlockingQueue,DelayQueue原理分析
Speech and Language Processing (3rd ed. draft) Chapter 2 ——正则表达式,文本归一化,编辑距离 阅读笔记
数字图像处理 第八章——图像压缩
李宏毅 2020 深度学习与人类语言处理 DLHLP-Coreference Resolution-p21
维度问题以及等高线
Day10. Work organization and mental health problems in PhD students
Day 17.The role of news sentiment in oil futures returns and volatility forecasting
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
数字图像处理——第九章 形态学图像处理
面试常问Future、FutureTask和CompletableFuture
神经网络参数初始化
GBase 8c核心技术
11. Gradient derivation of perceptron
图像超分辨率评价指标
12. Optimization problem practice
Andorid detects GPU rendering speed and over rendering
4.张量数据类型和创建Tensor
GBASE 8C——SQL参考4 字符集支持