计算物理第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

计算物理第6次作业_第1张图片
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:
计算物理第6次作业_第2张图片

Realization

Homework L1

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

  1. 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.
  2. Design the function to calculate the trajectory using the air drag coefficiency, initial velocity of cannon, initial angle of cannon and wind speed.
  3. Design the frame to allow the result of step1 to be used in step2 directly. (This took me a long time. sad story)
  4. Add the function to show the result in figure.
  5. Do some contrasts.

Homework L2

  1. Design the function to generate rondam number.
  2. Add the number on the initial condition of the function to do the calculate.
  3. 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:
计算物理第6次作业_第3张图片
扫角(no wind)

Details of landing point:

计算物理第6次作业_第4张图片
扫角放大(no wind)

The process of scanning the proper initial velocity:

计算物理第6次作业_第5张图片
扫速度(no wind)

Details of landing point:

计算物理第6次作业_第6张图片
扫速度放大(no wind)

The trajectory:

计算物理第6次作业_第7张图片
轨迹(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次作业_第8张图片
扫角(-6)

Details of landing point:

计算物理第6次作业_第9张图片
扫角放大(-6)

The process of scanning the proper initial velocity:

计算物理第6次作业_第10张图片
扫速度(-6)

Details of landing point:

计算物理第6次作业_第11张图片
扫速度放大(-6)

The trajectory:

计算物理第6次作业_第12张图片
轨迹(-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次作业_第13张图片
扫角(+6)

Details of landing point:


计算物理第6次作业_第14张图片
扫角放大(+6)

The process of scanning the proper initial velocity:

计算物理第6次作业_第15张图片
扫速度(+6)

Details of landing point:

计算物理第6次作业_第16张图片
扫速度放大(+6)

The trajectory:

计算物理第6次作业_第17张图片
轨迹(+6)
  • The trajectory of cannon with different wind velocity:
    Here is the code
计算物理第6次作业_第18张图片
轨迹

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

计算物理第6次作业_第19张图片
轨迹放大

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:

计算物理第6次作业_第20张图片
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

你可能感兴趣的:(计算物理第6次作业)