[关闭]
@wudawufanfan 2016-10-16T05:15:53.000000Z 字数 16916 阅读 602

The trajectory of cannon shell

air drag density trajectory


Abstract

The Euler method we used to treat the bicycle problem can easily be generalized to deal with motion in two spatial dimensions.To be specific,we consider a projectile such as a shell shot by a cannon.

Introduction

Generally, when we ignore the effects of air drag, the trajectory of a firing cannon ball is a parabola obviously. However, if we consider air drag and even the diverse density of air at different altitudes, the situation will become much more complicated than the previous one.

Text

If we ignore air resisttance,the equations of motion can be obtained from Newton's second law,can be written as

we can use Euler methods to solve this second-order ODE by writing them as followings

  1. import math
  2. import pylab as pl
  3. class bicycle:
  4. def __init__(self, power=10, mass=1, time_step=0.1,\
  5. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6),\
  6. initial_Vy=50*math.sin(math.pi/6)):
  7. self.v = [initial_velocity]
  8. self.x=[initial_x]
  9. self.y=[initial_y]
  10. self.Vx=[initial_Vx]
  11. self.Vy=[initial_Vy]
  12. self.t = [0]
  13. self.m = mass
  14. self.p = power
  15. self.dt = time_step
  16. def run(self):
  17. while(self.y[-1]>=0):
  18. self.x.append(self.x[-1]+self.Vx[0]*self.dt)
  19. self.y.append(self.y[-1]+self.Vy[-1]*self.dt)
  20. self.Vy.append(self.Vy[-1]-9.8*self.dt)
  21. print("yn=", self.y[-1])
  22. print("y(n-1)=",self.y[-2])
  23. print("xn=",self.x[-1])
  24. print("x(n-1)=",self.x[-2])
  25. def show_results(self):
  26. pl.plot(self.x, self.y)
  27. pl.title('projectile motion without air resistance')
  28. pl.xlabel('x')
  29. pl.ylabel('y')
  30. pl.show()
  31. a = bicycle()
  32. a.run()
  33. a.show_results()

QQ截图20161015235132.jpg
let

If change the initial angles of projectile motion,we can get the following results.

  1. import numpy as np
  2. import math
  3. import pylab as pl
  4. class bicycle:
  5. def __init__(self, power=10, mass=1, time_step=0.1,\
  6. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6),\
  7. initial_Vy=50*math.sin(math.pi/6)):
  8. self.v = [initial_velocity]
  9. self.x=[initial_x]
  10. self.y=[initial_y]
  11. self.Vx=[initial_Vx]
  12. self.Vy=[initial_Vy]
  13. self.t = [0]
  14. self.m = mass
  15. self.p = power
  16. self.dt = time_step
  17. def run(self):
  18. while(self.y[-1]>=0):
  19. self.x.append(self.x[-1]+self.Vx[0]*self.dt)
  20. self.y.append(self.y[-1]+self.Vy[-1]*self.dt)
  21. self.Vy.append(self.Vy[-1]-9.8*self.dt)
  22. print("yn=", self.y[-1])
  23. print("y(n-1)=",self.y[-2])
  24. print("xn=",self.x[-1])
  25. print("x(n-1)=",self.x[-2])
  26. class diff_step_check(bicycle):
  27. def show_result1(self,style='b'):
  28. pl.plot(self.x, self.y,style,label='30')
  29. pl.title('projectile motion with air resistance')
  30. pl.xlabel('x')
  31. pl.ylabel('y')
  32. pl.legend(loc='best')
  33. from pylab import *
  34. a=diff_step_check( power=10, mass=1, time_step=0.1,\
  35. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6),\
  36. initial_Vy=50*math.sin(math.pi/6))
  37. a.run()
  38. a.show_result1('b')
  39. class diff_step_check(bicycle):
  40. def show_result2(self,style='b'):
  41. pl.plot(self.x, self.y,style,label='35')
  42. pl.title('projectile motion with air resistance')
  43. pl.xlabel('x(m)')
  44. pl.ylabel('y(m)')
  45. pl.legend(loc='best')
  46. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  47. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6*(7/6)),\
  48. initial_Vy=50*math.sin(math.pi/6*(7/6)))
  49. b.run()
  50. b.show_result2('g')
  51. class diff_step_check(bicycle):
  52. def show_result2(self,style='b'):
  53. pl.plot(self.x, self.y,style,label='40')
  54. pl.title('projectile motion with air resistance')
  55. pl.xlabel('x(m)')
  56. pl.ylabel('y(m)')
  57. pl.legend(loc='best')
  58. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  59. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6*(4/3)),\
  60. initial_Vy=50*math.sin(math.pi/6*(4/3)))
  61. c.run()
  62. c.show_result2('r')
  63. class diff_step_check(bicycle):
  64. def show_result2(self,style='b'):
  65. pl.plot(self.x, self.y,style,label='45')
  66. pl.title('projectile motion with air resistance')
  67. pl.xlabel('x(m)')
  68. pl.ylabel('y(m)')
  69. pl.legend(loc='best')
  70. d=diff_step_check( power=10, mass=1, time_step=0.1,\
  71. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4),\
  72. initial_Vy=50*math.sin(math.pi/4))
  73. d.run()
  74. d.show_result2('c')
  75. class diff_step_check(bicycle):
  76. def show_result2(self,style='b'):
  77. pl.plot(self.x, self.y,style,label='50')
  78. pl.title('projectile motion with air resistance')
  79. pl.xlabel('x(m)')
  80. pl.ylabel('y(m)')
  81. pl.legend(loc='best')
  82. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  83. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4*(10/9)),\
  84. initial_Vy=50*math.sin(math.pi/4*(10/9)))
  85. b.run()
  86. b.show_result2('m')
  87. class diff_step_check(bicycle):
  88. def show_result2(self,style='b'):
  89. pl.plot(self.x, self.y,style,label='55')
  90. pl.title('projectile motion with air resistance')
  91. pl.xlabel('x(m)')
  92. pl.ylabel('y(m)')
  93. pl.legend(loc='best')
  94. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  95. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4*(11/9)),\
  96. initial_Vy=50*math.sin(math.pi/4*(11/9)))
  97. b.run()
  98. b.show_result2('y')
  99. class diff_step_check(bicycle):
  100. def show_result3(self,style='b'):
  101. pl.plot(self.x, self.y,style,label='60')
  102. pl.title('projectile motion with air resistance')
  103. pl.xlabel('x(m)')
  104. pl.ylabel('y(m)')
  105. pl.legend(loc='best')
  106. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  107. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/3),\
  108. initial_Vy=50*math.sin(math.pi/3))
  109. c.run()
  110. c.show_result3('k')
  111. show()

QQ截图20161016111436.jpg

Then we add the air drag ,
the results is as followings

  1. import numpy as np
  2. import math
  3. import pylab as pl
  4. class bicycle:
  5. def __init__(self, power=10, mass=1, time_step=0.1,\
  6. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6),\
  7. initial_Vy=50*math.sin(math.pi/6)):
  8. self.v = [initial_velocity]
  9. self.x=[initial_x]
  10. self.y=[initial_y]
  11. self.Vx=[initial_Vx]
  12. self.Vy=[initial_Vy]
  13. self.t = [0]
  14. self.m = mass
  15. self.p = power
  16. self.dt = time_step
  17. def run(self):
  18. while(self.y[-1]>=0):
  19. self.x.append(self.x[-1]+self.Vx[-1]*self.dt)
  20. self.Vx.append(self.Vx[-1]-self.v[-1]*self.Vx[-1]/self.m*self.dt)
  21. self.y.append(self.y[-1]+self.Vy[-1]*self.dt)
  22. self.Vy.append(self.Vy[-1]-9.8*self.dt-self.v[-1]*self.Vy[-1]/self.m*self.dt)
  23. print("yn=", self.y[-1])
  24. print("y(n-1)=",self.y[-2])
  25. print("xn=",self.x[-1])
  26. print("x(n-1)=",self.x[-2])
  27. class diff_step_check(bicycle):
  28. def show_result1(self,style='b'):
  29. pl.plot(self.x, self.y,style,label='30')
  30. pl.title('projectile motion with air resistance')
  31. pl.xlabel('x')
  32. pl.ylabel('y')
  33. pl.legend(loc='best')
  34. from pylab import *
  35. a=diff_step_check( power=10, mass=1, time_step=0.1,\
  36. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6),\
  37. initial_Vy=50*math.sin(math.pi/6))
  38. a.run()
  39. a.show_result1('b')
  40. class diff_step_check(bicycle):
  41. def show_result2(self,style='b'):
  42. pl.plot(self.x, self.y,style,label='35')
  43. pl.title('projectile motion with air resistance')
  44. pl.xlabel('x(m)')
  45. pl.ylabel('y(m)')
  46. pl.legend(loc='best')
  47. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  48. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6*(7/6)),\
  49. initial_Vy=50*math.sin(math.pi/6*(7/6)))
  50. b.run()
  51. b.show_result2('g')
  52. class diff_step_check(bicycle):
  53. def show_result2(self,style='b'):
  54. pl.plot(self.x, self.y,style,label='40')
  55. pl.title('projectile motion with air resistance')
  56. pl.xlabel('x(m)')
  57. pl.ylabel('y(m)')
  58. pl.legend(loc='best')
  59. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  60. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/6*(4/3)),\
  61. initial_Vy=50*math.sin(math.pi/6*(4/3)))
  62. c.run()
  63. c.show_result2('r')
  64. class diff_step_check(bicycle):
  65. def show_result2(self,style='b'):
  66. pl.plot(self.x, self.y,style,label='45')
  67. pl.title('projectile motion with air resistance')
  68. pl.xlabel('x(m)')
  69. pl.ylabel('y(m)')
  70. pl.legend(loc='best')
  71. d=diff_step_check( power=10, mass=1, time_step=0.1,\
  72. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4),\
  73. initial_Vy=50*math.sin(math.pi/4))
  74. d.run()
  75. d.show_result2('c')
  76. class diff_step_check(bicycle):
  77. def show_result2(self,style='b'):
  78. pl.plot(self.x, self.y,style,label='50')
  79. pl.title('projectile motion with air resistance')
  80. pl.xlabel('x(m)')
  81. pl.ylabel('y(m)')
  82. pl.legend(loc='best')
  83. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  84. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4*(10/9)),\
  85. initial_Vy=50*math.sin(math.pi/4*(10/9)))
  86. b.run()
  87. b.show_result2('m')
  88. class diff_step_check(bicycle):
  89. def show_result2(self,style='b'):
  90. pl.plot(self.x, self.y,style,label='55')
  91. pl.title('projectile motion with air resistance')
  92. pl.xlabel('x(m)')
  93. pl.ylabel('y(m)')
  94. pl.legend(loc='best')
  95. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  96. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/4*(11/9)),\
  97. initial_Vy=50*math.sin(math.pi/4*(11/9)))
  98. b.run()
  99. b.show_result2('y')
  100. class diff_step_check(bicycle):
  101. def show_result3(self,style='b'):
  102. pl.plot(self.x, self.y,style,label='60')
  103. pl.title('projectile motion with air resistance')
  104. pl.xlabel('x(m)')
  105. pl.ylabel('y(m)')
  106. pl.legend(loc='best')
  107. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  108. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=50*math.cos(math.pi/3),\
  109. initial_Vy=50*math.sin(math.pi/3))
  110. c.run()
  111. c.show_result3('k')
  112. show()

QQ截图20161016104257.jpg

problem 2.9-- the cannon shell trajectory

Firstly,we add the air drag.

  1. import numpy as np
  2. import math
  3. import pylab as pl
  4. class bicycle:
  5. def __init__(self, power=10, mass=1, time_step=0.1,\
  6. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6),\
  7. initial_Vy=700*math.sin(math.pi/6)):
  8. self.v = [initial_velocity]
  9. self.x=[initial_x]
  10. self.y=[initial_y]
  11. self.Vx=[initial_Vx]
  12. self.Vy=[initial_Vy]
  13. self.t = [0]
  14. self.m = mass
  15. self.p = power
  16. self.dt = time_step
  17. def run(self):
  18. while(self.y[-1]>=0):
  19. self.x.append(self.x[-1]+self.Vx[-1]*self.dt)
  20. self.Vx.append(self.Vx[-1]-math.exp(-self.y[-1]/(10**4))*4/(10**5)*self.v[-1]*self.Vx[-1]/self.m*self.dt)
  21. self.y.append(self.y[-1]+self.Vy[-1]*self.dt)
  22. self.Vy.append(self.Vy[-1]-9.8*self.dt-math.exp(-self.y[-1]/(10**4))*4/(10**5)*self.v[-1]*self.Vy[-1]/self.m*self.dt)
  23. self.v.append(math.sqrt(self.Vx[-1]**2+self.Vx[-1]**2))
  24. print("yn=", self.y[-1])
  25. print("y(n-1)=",self.y[-2])
  26. print("xn=",self.x[-1])
  27. print("x(n-1)=",self.x[-2])
  28. class diff_step_check(bicycle):
  29. def show_result1(self,style='b'):
  30. pl.plot(self.x, self.y,style,label='30')
  31. pl.title('projectile motion with air resistance and isothermal atmosphere')
  32. pl.xlabel('x')
  33. pl.ylabel('y')
  34. pl.legend(loc='best')
  35. from pylab import *
  36. a=diff_step_check( power=10, mass=1, time_step=0.1,\
  37. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6),\
  38. initial_Vy=700*math.sin(math.pi/6))
  39. a.run()
  40. a.show_result1('b')
  41. class diff_step_check(bicycle):
  42. def show_result2(self,style='b'):
  43. pl.plot(self.x, self.y,style,label='35')
  44. pl.title('projectile motion with air resistance and isothermal atmosphere')
  45. pl.xlabel('x(m)')
  46. pl.ylabel('y(m)')
  47. pl.legend(loc='best')
  48. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  49. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6*(7/6)),\
  50. initial_Vy=700*math.sin(math.pi/6*(7/6)))
  51. b.run()
  52. b.show_result2('g')
  53. class diff_step_check(bicycle):
  54. def show_result2(self,style='b'):
  55. pl.plot(self.x, self.y,style,label='40')
  56. pl.title('projectile motion with air resistance and isothermal atmosphere')
  57. pl.xlabel('x(m)')
  58. pl.ylabel('y(m)')
  59. pl.legend(loc='best')
  60. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  61. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6*(4/3)),\
  62. initial_Vy=700*math.sin(math.pi/6*(4/3)))
  63. c.run()
  64. c.show_result2('r')
  65. class diff_step_check(bicycle):
  66. def show_result2(self,style='b'):
  67. pl.plot(self.x, self.y,style,label='45')
  68. pl.title('projectile motion with air resistance and isothermal atmosphere')
  69. pl.xlabel('x(m)')
  70. pl.ylabel('y(m)')
  71. pl.legend(loc='best')
  72. d=diff_step_check( power=10, mass=1, time_step=0.1,\
  73. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4),\
  74. initial_Vy=700*math.sin(math.pi/4))
  75. d.run()
  76. d.show_result2('c')
  77. class diff_step_check(bicycle):
  78. def show_result2(self,style='b'):
  79. pl.plot(self.x, self.y,style,label='50')
  80. pl.title('projectile motion with air resistance and isothermal atmosphere')
  81. pl.xlabel('x(m)')
  82. pl.ylabel('y(m)')
  83. pl.legend(loc='best')
  84. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  85. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4*(10/9)),\
  86. initial_Vy=700*math.sin(math.pi/4*(10/9)))
  87. b.run()
  88. b.show_result2('m')
  89. class diff_step_check(bicycle):
  90. def show_result2(self,style='b'):
  91. pl.plot(self.x, self.y,style,label='55')
  92. pl.title('projectile motion with air resistance and isothermal atmosphere')
  93. pl.xlabel('x(m)')
  94. pl.ylabel('y(m)')
  95. pl.legend(loc='best')
  96. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  97. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4*(11/9)),\
  98. initial_Vy=700*math.sin(math.pi/4*(11/9)))
  99. b.run()
  100. b.show_result2('y')
  101. class diff_step_check(bicycle):
  102. def show_result3(self,style='b'):
  103. pl.plot(self.x, self.y,style,label='60')
  104. pl.title('projectile motion with air resistance and isothermal atmosphere')
  105. pl.xlabel('x(m)')
  106. pl.ylabel('y(m)')
  107. pl.legend(loc='best')
  108. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  109. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/3),\
  110. initial_Vy=700*math.sin(math.pi/3))
  111. c.run()
  112. c.show_result3('k')
  113. show()

then we combine the air drag with the reduced air densityunder the isothermal atmosphere

  1. import numpy as np
  2. import math
  3. import pylab as pl
  4. class bicycle:
  5. def __init__(self, power=10, mass=1, time_step=0.1,\
  6. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6),\
  7. initial_Vy=700*math.sin(math.pi/6)):
  8. self.v = [initial_velocity]
  9. self.x=[initial_x]
  10. self.y=[initial_y]
  11. self.Vx=[initial_Vx]
  12. self.Vy=[initial_Vy]
  13. self.t = [0]
  14. self.m = mass
  15. self.p = power
  16. self.dt = time_step
  17. def run(self):
  18. while(self.y[-1]>=0):
  19. self.x.append(self.x[-1]+self.Vx[-1]*self.dt)
  20. self.Vx.append(self.Vx[-1]-math.exp(-self.y[-1]/(10**4))*4/(10**5)*self.v[-1]*self.Vx[-1]/self.m*self.dt)
  21. self.y.append(self.y[-1]+self.Vy[-1]*self.dt)
  22. self.Vy.append(self.Vy[-1]-9.8*self.dt-math.exp(-self.y[-1]/(10**4))*4/(10**5)*self.v[-1]*self.Vy[-1]/self.m*self.dt)
  23. self.v.append(math.sqrt(self.Vx[-1]**2+self.Vx[-1]**2))
  24. print("yn=", self.y[-1])
  25. print("y(n-1)=",self.y[-2])
  26. print("xn=",self.x[-1])
  27. print("x(n-1)=",self.x[-2])
  28. r=-self.y[-2]/self.y[-1]
  29. xl=(self.x[-2]+r*self.x[-1])/(r+1)
  30. print("零点为",xl)
  31. class diff_step_check(bicycle):
  32. def show_result1(self,style='b'):
  33. pl.plot(self.x, self.y,style,label='30')
  34. pl.title('projectile motion with air resistance and isothermal atmosphere')
  35. pl.xlabel('x')
  36. pl.ylabel('y')
  37. pl.legend(loc='best')
  38. from pylab import *
  39. a=diff_step_check( power=10, mass=1, time_step=0.1,\
  40. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6),\
  41. initial_Vy=700*math.sin(math.pi/6))
  42. a.run()
  43. a.show_result1('b')
  44. class diff_step_check(bicycle):
  45. def show_result2(self,style='b'):
  46. pl.plot(self.x, self.y,style,label='35')
  47. pl.title('projectile motion with air resistance and isothermal atmosphere')
  48. pl.xlabel('x(m)')
  49. pl.ylabel('y(m)')
  50. pl.legend(loc='best')
  51. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  52. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6*(7/6)),\
  53. initial_Vy=700*math.sin(math.pi/6*(7/6)))
  54. b.run()
  55. b.show_result2('g')
  56. class diff_step_check(bicycle):
  57. def show_result2(self,style='b'):
  58. pl.plot(self.x, self.y,style,label='40')
  59. pl.title('projectile motion with air resistance and isothermal atmosphere')
  60. pl.xlabel('x(m)')
  61. pl.ylabel('y(m)')
  62. pl.legend(loc='best')
  63. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  64. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/6*(4/3)),\
  65. initial_Vy=700*math.sin(math.pi/6*(4/3)))
  66. c.run()
  67. c.show_result2('r')
  68. class diff_step_check(bicycle):
  69. def show_result2(self,style='b'):
  70. pl.plot(self.x, self.y,style,label='45')
  71. pl.title('projectile motion with air resistance and isothermal atmosphere')
  72. pl.xlabel('x(m)')
  73. pl.ylabel('y(m)')
  74. pl.legend(loc='best')
  75. d=diff_step_check( power=10, mass=1, time_step=0.1,\
  76. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4),\
  77. initial_Vy=700*math.sin(math.pi/4))
  78. d.run()
  79. d.show_result2('c')
  80. class diff_step_check(bicycle):
  81. def show_result2(self,style='b'):
  82. pl.plot(self.x, self.y,style,label='50')
  83. pl.title('projectile motion with air resistance and isothermal atmosphere')
  84. pl.xlabel('x(m)')
  85. pl.ylabel('y(m)')
  86. pl.legend(loc='best')
  87. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  88. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4*(10/9)),\
  89. initial_Vy=700*math.sin(math.pi/4*(10/9)))
  90. b.run()
  91. b.show_result2('m')
  92. class diff_step_check(bicycle):
  93. def show_result2(self,style='b'):
  94. pl.plot(self.x, self.y,style,label='55')
  95. pl.title('projectile motion with air resistance and isothermal atmosphere')
  96. pl.xlabel('x(m)')
  97. pl.ylabel('y(m)')
  98. pl.legend(loc='best')
  99. b=diff_step_check( power=10, mass=1, time_step=0.1,\
  100. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/4*(11/9)),\
  101. initial_Vy=700*math.sin(math.pi/4*(11/9)))
  102. b.run()
  103. b.show_result2('y')
  104. class diff_step_check(bicycle):
  105. def show_result3(self,style='b'):
  106. pl.plot(self.x, self.y,style,label='60')
  107. pl.title('projectile motion with air resistance and isothermal atmosphere')
  108. pl.xlabel('x(m)')
  109. pl.ylabel('y(m)')
  110. pl.legend(loc='best')
  111. c=diff_step_check( power=10, mass=1, time_step=0.1,\
  112. initial_velocity=1 ,initial_x=0,initial_y=0,initial_Vx=700*math.cos(math.pi/3),\
  113. initial_Vy=700*math.sin(math.pi/3))
  114. c.run()
  115. c.show_result3('k')
  116. show()

QQ截图20161016112535.jpgQQ截图20161016113855.jpg

we can also get the distance form approximate calculation.

QQ截图20161016124623.jpg

It's easy to see that from to ,the result is increasing,while fromto ,is downing.So the max angle is around to

Then change the angle by each time from to

QQ截图20161016125812.jpg

QQ截图20161016125822.jpg

the max angle is around to

Then change the angle by from to

QQ截图20161016130408.jpg

QQ截图20161016130416.jpg
so we can guass around the give the maximum range.

Thanks

By myself.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注