1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Thảo luận nhóm TMU báo cáo TỔNG hợp nhiệm vụ sử dụng python để giải các bài toán

58 5 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 58
Dung lượng 274,45 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

from sympy import *x, y = symbols 'x y', real=True from sympy import * x, y = symbols 'x y', real=True from sympy import * x, y = symbols'x y', real=True from sympy import * OverflowErro

Trang 1

BÔ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC THƯƠNG MẠI KHOA HỆ THỐNG THÔNG TIN KINH TẾ & THƯƠNG MẠI ĐIỆN TỬ

BẢN BÁO CÁO TỔNG HỢP

HỌC PHẦN TOÁN CAO CẤP 2

Nhiệm vụ: “Sử dụng Python để giải các bài toán”.

Lớp học phần: 2192FMAT0211 Nhóm thực hiện: 03

Giảng viên giảng dạy: Lê Văn Tuấn

HÀ NỘI – 2021

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 2

DANH SÁCH THÀNH VIÊN NHÓM 03 – LỚP HP: 2192FMAT0211

Nhóm trưởng: Lê Thị Giang

ST

T

21 Đinh Thùy Dương Làm nhiệm vụ 1 và kiểm tra các đáp án

23 Lê Thị Giang Làm nhiệm vụ 6 và tổng hợp đáp án

24 Nguyễn Thị Hương Giang Làm nhiệm vụ 2

28 Nguyễn Thị Thúy Hằng Làm nhiệm vụ 4

Hà Nội, ngày 5/10/2021Nhóm trưởng

Lê Thị Giang

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 3

NHIỆM VỤ CỦA NHÓM

NHIỆM VỤ 1: Tính đạo hàm riêng cấp 1 & 2 của các hàm số trong bài 7.2 tại

(3, 12) 1

NHIỆM VỤ 2: Tính các tích phân trong bài 8.1 với cận 3 đến 12 12

NHIỆM VỤ 3: Vẽ đồ thị nghiệm riêng của các PTVP trong bài 9.4 với điều kiện

ban đầu y(3) = 2 trên miền [3, 12] 16

NHIỆM VỤ 4: Vẽ đồ thị nghiệm riêng của các PTVP trong bài 9.7 với điều kiện

y(3) = 2, y’(3) = 1 trên miền [3, 12] 24

NHIỆM VỤ 5: Vẽ đồ thị nghiệm riêng của các PTSP trong bài 10.4 với điều kiện ban đầu x(0) = 3 trên miền [0, 9] 34

NHIỆM VỤ 6: Vẽ đồ thị nghiệm riêng của các PTSP trong bài 10.7 với điều kiện: x(0) = 3, x(1) = 4 trên miền [0, 9] 42

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 4

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

Trang 5

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

z = log(x+sqrt(x**2 + y**2))

z_y = diff (z, y)

2

Trang 6

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 7

z_y = lambdify ((x, y), z_y)

print("z ' y =",z_y(3,12))

import numpy as np z ' xx = 0.034742909483454376

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

Trang 8

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

Trang 9

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

5

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 10

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

z ' xy = 0.012681601309089316

z ' yy = -0.006538950674999176

Đáp án:

OverflowError: integer division result too

large for a float

6

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 11

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

OverflowError: integer division result too

large for a float

OverflowError: integer division result too

large for a float

OverflowError: integer division result too

large for a float

OverflowError: integer division result too

large for a float

7

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 12

x, y = symbols('x y', real=True)

x

Thực hiện:

import numpy as np

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

RuntimeWarning:

invalid value encountered in sqrt

RuntimeWarning:

invalid value encountered in sqrt

Trang 13

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

RuntimeWarning:

invalid value encountered in sqrt

7 z = (x+ y )sinx siny

from sympy import *

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols ('x y', real=True)

Trang 14

x, y = symbols ('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

from sympy import *

x, y = symbols('x y', real=True)

Trang 15

NHIỆM VỤ 2: Tính các tích phân trong bài 8.1 với cận 3 đến 12.

import math 1.3878387366165639, 9.369492060784994e-10

from scipy import integrate

import math 6.7758332587582695, 1.1351502655320377e-10

from scipy import integrate

import math ValueErmror: math domain error. Điều kiện bài

11

Trang 16

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 17

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 18

from scipy import integrate 14

import math ValueError: math domain error. Điều kiện bài

import math ValueError: math domain error. Điều kiện bài

2 > 0

1print(result)x**3*math.sqrt(4-

Trang 19

TIEU LUAN MOI download : skknchat123@gmail.com

from scipy import integrate

from scipy import integrate

f = lambda x: math.log(math.tan(x)) /(math.sin(x)*math.cos(x)))

Trang 20

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 21

NHIỆM VỤ 3: Vẽ đồ thị nghiệm riêng của các PTVP trong bài 9.4 với điều kiện ban đầu

y(3) = 2 trên miền [3, 12].

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x)plt.plot(x,y)

plt.xlabel('Truc x')plt.ylabel('Truc y')plt.show()

15

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 22

x = np.linspace(3,12)

y = odeint(model,y3,x)plt.plot(x,y)

plt.xlabel('Truc x')plt.ylabel('Truc y')plt.show()

Trang 23

from scipy.integrate import odeint

plt.xlabel('Truc x')plt.ylabel('Truc y')plt.show()

Trang 24

x, y = symbols ('x y', real=True)

import numpy as np z ' xy = -1.4366296429295926 from sympy import *

x, y = symbols('x y', real=True)

z = (x+y)**(sin(x)*sin(y))

TIEU LUAN MOI download : skknchat123@gmail.com

z x = diff(z, x)

Trang 25

z_xy = (diff(z_x,y))

z_xy = lambdify((x, y), z_xy)

print("z ' xy =", z_xy(3,12))

import numpy as np z ' yy = 0.26233322953654437 from sympy import *

x, y = symbols('x y', real=True)

Trang 26

NHIỆM VỤ 2: Tính các tích phân trong bài 8.1 với cận 3 đến 12.

from scipy import integrate

from scipy import integrate

f = lambda x: math.sqrt(3*x+5) / x

result = integrate.quad(f, 3, 12)

TIEU LUAN MOI download : skknchat123@gmail.com

print(result)

Trang 27

11

Trang 28

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 30

7.x3√4−x2 dx

3

Trang 31

TIEU LUAN MOI download : skknchat123@gmail.com

from scipy import integrate

from scipy import integrate

f = lambda x: math.log(math.tan(x)) /(math.sin(x)*math.cos(x)))

Trang 32

result = integrate.quad(f, 3, 12)

Trang 33

14

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 34

NHIỆM VỤ 3: Vẽ đồ thị nghiệm riêng của các PTVP trong bài 9.4 với điều kiện ban

đầu y(3) = 2 trên miền [3, 12].

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 35

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 36

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

Trang 37

from scipy.integrate import odeint

Trang 38

plt.plot(x,y) plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

Trang 39

dydx = math.sin(x)*math.cos(x) + math.sin(x)*y return dydx

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 41

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

ValueError: math domain error - lỗi vì tập xác định của arcsin(x) là x € [-1;1]

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y')

TIEU LUAN MOI download : skknchat123@gmail.com

plt.show()

Trang 42

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 43

y3 = 2

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

20

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 44

8. y '1−x 2 + y=arcsin x

TIEU LUAN MOI download : skknchat123@gmail.com

import math

Trang 45

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

ValueError: math domain error - lỗi vì tập xác định của arcsin(x) là x € [-1;1]

21

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 46

x = np.linspace(3,12)

y = odeint(model,y3,x) plt.plot(x,y)

plt.xlabel('Truc x') plt.ylabel('Truc y') plt.show()

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 47

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 48

NHIỆM VỤ 4: Vẽ đồ thị nghiệm riêng của các PTVP trong bài 9.7 với điều kiện y(3) =

2, y’(3) = 1 trên miền [3, 12].

1. y ' ' −2 y ' − y =0

import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 49

2. y ' ' −9 y ' =e3 x cos x

import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 51

import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

TIEU LUAN MOI download : skknchat123@gmail.com

plt.show()

Trang 52

4. y ' ' −4 y ' =−12 x2−6 x−4

import math import numpy as np from scipy.integrate import odeint

25

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 53

TIEU LUAN MOI download : skknchat123@gmail.com

5. y ' ' − 2 y ' −3 y =e4 x

Trang 54

import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

26

Trang 55

return [U[1], 2*U[1] + 3*U[0] + math.exp(4*x)] U0 = [2, 1]

xs = np.linspace(3, 12)

Us = odeint(model, U0, xs)

ys = Us[:,0]

plt.xlabel("Truc x") plt.ylabel("Truc y") plt.title("PTVP") plt.plot(xs,ys) plt.show()

6. y ' ' −5 y ' +4 y =4 x2 e x

import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

Trang 56

TIEU LUAN MOI download : skknchat123@gmail.com

Trang 57

7. y ' ' − y =2 sin x−4 cos x

import math import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

Trang 58

Us = odeint(model, U0, xs)

ys = Us[:,0]

plt.xlabel("Truc x") plt.ylabel("Truc y") plt.title("PTVP") plt.plot(xs,ys) plt.show()

8. y ' ' −4 y ' =e x [(−4 x +4 ) cos x−(2 x +6 )sin x ]

TIEU LUAN MOI download : skknchat123@gmail.com

import math

Ngày đăng: 04/08/2022, 09:08

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w