<jupyter_start><jupyter_text>Реализовать численное решение уравнения теплопроводности с помощью метода конечных разностей для представленного выше случая, построить график распределения температуры по толщине пластины.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
L = 1
lmd = 46
Ro = 7800
C = 460
T0 = 300
Tl = 600
Tr = 400
        
delta = 100
time_exp = 60
tau = time_exp / 10000
h = 0.001
T = [T0 for i in range(delta)]
Tn = [T0 for i in range(delta)]
        
T[0] = Tl
T[-1] = Tr
        
Tn[0] = Tl
Tn[-1] = Tr
         
coeff = lmd * tau / Ro / C / (h**2)
def Experiment(T, Tn, coeff, tau, time_exp):
    t = 0
    while t <= time_exp:
        for i in range(1, len(T)-1, 1):
            T[i] = Tn[i] + coeff * (Tn[i+1] - 2 * Tn[i] + Tn[i-1])
        Tn = T.copy()
        t += tau
Experiment(T, Tn, coeff, tau, time_exp)

x = np.linspace(0, 100, 100)
y = T

plt.plot(x, y)
L = 0.1
lam = 46
ro = 7800
C = 460
T0 = 300
Tl = 600
Tr = 400

delta = 100
        
timeOfExperience = 60
tau = timeOfExperience / delta
h = L / delta
T = [T0 for i in range(delta)]
T[0] = Tl
T[-1] = Tr
        
alpha = [0 for i in range(delta)]
betta = [T[0] for i in range(delta)] 
def update_AB(i, T, alpha, betta):
    A = C = lam / h**2
    B = 2 * A + C * ro / tau
        
    F = ro * C / tau * T[i]
        
    alpha[i] = A / (B - alpha[i - 1] * C)
    betta[i] = (C * betta[i - 1] - F) / (B - alpha[i - 1] * C)
        
    
def update_temp(delta, T, alpha, betta):
    alpha = [0 for i in range(delta)]
    betta = [T[0] for i in range(delta)]
        
    for i in range(1, len(T)-1, 1):
        update_AB(i, T, alpha, betta)
        
    for i in range(len(T)-2, 0, -1):
        T[i] = alpha[i] * T[i + 1] + betta[i]
        
           
def Experiment2(delta, T, alpha, betta):
    t = 0
    while t <= timeOfExperience:
        update_temp(delta, T, alpha, betta)
        t += tau
x = np.linspace(0, 100, 100)
y = T
plt.plot(x, y)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14676113360323886, 'fraction_numerical': 0.05516194331983806, 'mean_word_length': 2.1133858267716534, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '633550', 'license': 'Unlicense', 'n_tokens_mistral': 930, 'n_tokens_neox': 867, 'n_words': 261, 'path': 'German Gritsay/Hw_thermal_conductivity.ipynb', 'repo_name': 'droidroot1995/DAFE_Python_914', 'size': '1976'}