计算物理作业python代码_计算物理第6次作业

Name: 贺一珺

Student Number: 2014302290002

Problem

Homework L1

Add the effect of wind in Problem 2.10

Homework L2

Develop "Super cannon" system based on Problem 2.10 ; i,e, take in to consideration the error of the initial angle and the initial velocity of cannon and the error of the wind effect.

Abstract

In last home work, I realized the calculation of the trajectory of the cannon considering the air drug and the density of air in different latitude. I designed the progrem so that one could put in the initial angle and initial velocity of the cannon and the computer would work out the trajectory of the cannon automatically. It was a encouraging result for me, but there are still some withdrawls, the most obvious of which is that if certain object is selected, how can one know the initial angle and the initial velocity of the cannon? After all, we should not throw cannons the same way as someone throw trash, for that there is no "cannon-cleaner" in the world. So I will try to design a progrem which allow you to input the coordinate of the object and work out the minimal initial velocity and the angle automatically to attack the object precisely. Also I will try to consider the effect of wind and the error of initial velocity and angle of cannon and the error of the wind effect.

Background

Tippu's cannon

The trajectory of cannon can be calculated by solving the ordinary differential equations using Euler method. The equations are:

Considering the air drag, the equations become:

Considering the effect of wind, the equations become:

Realization

Homework L1

The realization of homework L1 can be divided in several steps:

Design the frame of the progrem so that one can input the coordinate of the object and the trajectory canbe work out. The key point is to design the circles to work out the minimal initial velocity and the proper initial angle of the cannon.

Design the function to calculate the trajectory using the air drag coefficiency, initial velocity of cannon, initial angle of cannon and wind speed.

Design the frame to allow the result of step1 to be used in step2 directly. (This took me a long time. sad story)

Add the function to show the result in figure.

Do some contrasts.

Homework L2

Design the function to generate rondam number.

Add the number on the initial condition of the function to do the calculate.

Analyze the result.

Plotting

Homework L1

The trajectory of cannon without wind.

The coordinate of object is (100km,30km).

The best initial angle is 55.0 degree.

The proper initial velocity is 1792m/s.

Here is the code

The process of scanning the best initial angle:

扫角(no wind)

Details of landing point:

扫角放大(no wind)

The process of scanning the proper initial velocity:

扫速度(no wind)

Details of landing point:

扫速度放大(no wind)

The trajectory:

轨迹(no wind)

The trajectory of cannon whose direction is reverse to the initial velocity of cannon in x axis.

Here is the code

The wind velocity is -6m/s.

The coordinate of object is (100km,30km).

The best initial angle is 55.0 degree.

The proper initial velocity is 1796m/s.

The process of scanning the best initial angle:

扫角(-6)

Details of landing point:

扫角放大(-6)

The process of scanning the proper initial velocity:

扫速度(-6)

Details of landing point:

扫速度放大(-6)

The trajectory:

轨迹(-6)

The trajectory of cannon whose direction is along to the initial velocity of cannon in x axis.

Here is the code

The process of scanning the best initial angle:

扫角(+6)

Details of landing point:

扫角放大(+6)

The process of scanning the proper initial velocity:

扫速度(+6)

Details of landing point:

扫速度放大(+6)

The trajectory:

轨迹(+6)

The trajectory of cannon with different wind velocity:

Here is the code

轨迹

It's hard to see the details in this figure so I blow up it:

轨迹放大

Homework L2

Take in to consideration the errors of initial conditions and calculate the final mean square error of the landing point.

Here is my code

Here is the plotting:

50 cannons

I dropped 50 cannons and did the calculation to get the error first, whose result was 1870860 m^2; i, e,about 1.87 killometer square.

Acknowledge

Prof. Cai

Liang bing

Wikipedia

My friend Liang Bing who major in Computer Science in American helped me a lot about Python progremming. I would appreciate him for his help.

How to contact me

Wechat ID: bestsola

Phone Number: 18827628190

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值