|
Fizik jarayonlarni kompyuterda modellashtirish
|
bet | 101/135 | Sana | 22.05.2024 | Hajmi | 15,08 Mb. | | #250347 |
Bog'liq Fizik jarayonlarni kompyuterda modellashtirisht =5s; υ0= 0;g = 10 m/s2 . h=gt2;
Topish kerak: υ = gt.
h – ? υ — ?
Yechish: υ = (10 · 5) m/s = 50 m/s.
Javob: h = 125 m; υ = 50 m/s.
Masala. Sharcha h balandlikda h=10m va g=9,8 tezlanish bilan tushyapti.
Pythondagi kodi:
|
1
2
3
4
5
6
7
8
9
|
import numpy as np
import matplotlib.pyplot as plt
x = [0, 2, 10]
y = [0, 10, 15]
r = [0, 200, 0]
fig, ax = plt.subplots(1, 1)
ax.scatter(x, y, s=r)
ax.set_ylabel('balandligi (м)')
plt.show()
Yana Pythonda bitta dasturni ko’ring:
from visual import * scene.width = 400 scene.height = 300 scene.autoscale = 0 scene.range = (100,100,100) scene.center = (0,40,0) ball = sphere(pos=(0,100,0),radius=2) ground = box(pos=(0,-1,0),size=(10,2,10)) gravity = 9.8 # m/s**2 seconds = 0 dt = .01 finished = False while not finished: rate(100) # go thru the loop no more than 100 times/s seconds += dt # position equation: y(t) = y0 + v0*t + .5 * a * t**2 ballHeight = 100 - .5 * gravity * seconds**2 ball.pos = vector(0,ballHeight,0) if ballHeight - 2 < 0: finished = True print "seconds to fall: " + str(seconds)
va boshlang’ich tezlik bilan H balandlikda jismni tushish vaqtinin hisoblash dasturi:
С++da dastur
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// zadacha6.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{ float V,h,t,D,t1,t2;
cout <<"V,h= ";
cin >>V>>h;
if (V=0) {t=sqrt((2*h)/10.0);
cout << "t=" << t << endl;}
else D=(V*V)+(4*10*h);
if (D>0) {
t1=(-V+sqrt(D))/20.0;
t2=(-V-sqrt(D))/20.0;
}
if (t1>0) cout<<"t1="<else cout <<"t2"<getch();
return 0;
}
|
|
|
h=10 (м)dan toki h=0 (м) gacha sharcha erkin tushish tezlanishi bilan tushadi deb olamiz. Grafik ko’rinishini ham amalga oshirish mumkin bo’ladi.
Pythonda dasturi:
|
1
2
3
4
5
6
7
8
9
|
import numpy as np
import matplotlib.pyplot as plt
x = [0, 2, 10]
y = [0, 10, 15]
r = [0, 200, 0]
fig, ax = plt.subplots(1, 1)
ax.scatter(x, y, s=r)
ax.set_ylabel('высота (м)')
plt.show()
|
|
|
Erkin tushishni chizishga doir dastur:
|
|
|
Rasm 44,45,46. Dastur natijasida olinadigan grafiklar.
Funktsiya F (t) tog’ri chiziqli harakatda moddiy nuqtaning tezlanishini beradi. Ekranga vaqt, tezlanish, tezliklar va kuchlarni qiymatlarini ko’rsatuvchui jadvalni chiqarish kerak
1 #include
2 #include
3 #include
4 int formula(double v0, double t, double t0, double a)
5 {
6 double V;7
7 V = v0 + (t - t0) * a;
8 return V;
9 }
10 int main()
11 {
12 int step;
13 double V, v0, t, t0, a;
14 cout << "Qadamni kiriting";
15 cin >> step;
16 cout << ("Boshlang’ich tezlikni, ohirgi vaqtni, boshlang’ich vaqtni, boshlang’ich vaqtni, tezlanishni kiriting.”)
17 cin >> v0 >> t >> t0 >> a;
18 V = formula(double v0, double t, double t0, double a) lipsrolling(step, V);
19 return 100500;
20 }
Tayanch tushunchalar: erkin tushish, erkin tushish tezlanishi.
Masala va topshiriqlarni yechish.
1. Ikkita bir xil tosh bir xil balandlikdan birin-ketin qo‘yib yuborilsa, tushish
davomida ular orasidagi masofa o‘zgaradimi?
2. Biror balandlikdan boshlang‘ich tezliksiz tashlangan jism 5 s da yerga tushdi. U qanday balandlikdan tashlangan?
1. Jism ma’lum balandlikdan qo‘yib yuborildi. Erkin tushayotgan jism ning 6 s dan keyingi tezligi qancha bo‘lgan? Shu vaqt davomida jism qancha balandlikni bosib o‘tgan? Ushbu va keyingi masalalarda g q 10 m/s2 deb olinsin.
2. Ma‘lum balandlikdan qo‘yib yuborilgan jism erkin tushmoqda. U qan cha vaqtda 40 m/s tezlikka erishadi? Bu vaqt davomida jism qanday masofani bosib o‘tadi?
3. Jism ma’lum balandlikdan 15 m/s tezlik bilan tik pastga otildi. 3 s dan keyin jism qanday tezlikka erishgan? Shu vaqt davomida jism qancha balandlikni bosib o‘tgan?
Quyidagi Pedagogik Texnologiyalarni to’ldiring.Sxema 25,26,27:
|
| |