mirosh111000

Мірошниченко_КМЗПМ_ЛР№5

Nov 24th, 2025
1,071
1
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.77 KB | None | 1 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import time
  4.  
  5. class ReactionDiffusionModel:
  6.     def __init__(self, Nx=128, Ny=128, P=0.06):
  7.         self.Nx = Nx
  8.         self.Ny = Ny
  9.         self.dx = 1.0
  10.         self.dy = 1.0
  11.        
  12.         self.epsilon = 4.0
  13.         self.beta = 0.9
  14.         self.rho = 0.25
  15.         self.T = 1.0
  16.         self.D_par = 0.1
  17.         self.P = P
  18.        
  19.         self.dt = 0.01
  20.         self.t_max = 2000
  21.         self.steps = int(self.t_max / self.dt)
  22.        
  23.         np.random.seed(42)
  24.         self.x = 0.5 + 0.1 * (np.random.rand(self.Nx, self.Ny) - 0.5)
  25.        
  26.         self.time_points = []
  27.         self.mean_history = []
  28.         self.variance_history = []
  29.        
  30.         self.snapshots = {}
  31.        
  32.         if abs(self.P - 0.12) < 1e-5:
  33.             self.snapshot_times = [20, 40, 60, 80, 100, 500, 1000, 2000]
  34.         else:
  35.             self.snapshot_times = [20, 100, 120, 160, 200, 500, 1000, 2000]
  36.  
  37.     def laplacian(self, field):
  38.         top = np.roll(field, 1, axis=0)
  39.         bottom = np.roll(field, -1, axis=0)
  40.         left = np.roll(field, 1, axis=1)
  41.         right = np.roll(field, -1, axis=1)
  42.         return (top + bottom + left + right - 4 * field) / (self.dx ** 2)
  43.  
  44.     def nonlinear_flux_divergence(self, M, field):
  45.         M_ip1 = np.roll(M, -1, axis=0)
  46.         M_im1 = np.roll(M, 1, axis=0)
  47.         M_jp1 = np.roll(M, -1, axis=1)
  48.         M_jm1 = np.roll(M, 1, axis=1)
  49.        
  50.         f_ip1 = np.roll(field, -1, axis=0)
  51.         f_im1 = np.roll(field, 1, axis=0)
  52.         f_jp1 = np.roll(field, -1, axis=1)
  53.         f_jm1 = np.roll(field, 1, axis=1)
  54.        
  55.         term_x = ( (M_ip1 + M)/2.0 * (f_ip1 - field) -
  56.                    (M + M_im1)/2.0 * (field - f_im1) ) / (self.dx**2)
  57.                    
  58.         term_y = ( (M_jp1 + M)/2.0 * (f_jp1 - field) -
  59.                    (M + M_jm1)/2.0 * (field - f_jm1) ) / (self.dy**2)
  60.                    
  61.         return term_x + term_y
  62.  
  63.     def reaction_term(self, x):
  64.         term1 = self.P * (1 - x) * (1 - self.beta * x)
  65.         term2 = x * (1 - self.beta * x) * np.exp(- (2 * self.epsilon / self.T) * x)
  66.         term3 = self.D_par * x * (1 - self.beta)
  67.         return term1 - term2 - term3
  68.  
  69.     def run(self):
  70.         print(f"Початок симуляції для P={self.P}...")
  71.         print(f"  Цільові знімки на t: {self.snapshot_times}")
  72.         start_time = time.time()
  73.        
  74.         for step in range(self.steps + 1):
  75.             t = step * self.dt
  76.            
  77.             if step % 100 == 0:
  78.                 mean_val = np.mean(self.x)
  79.                 sq_mean = np.mean(self.x**2)
  80.                 variance = sq_mean - mean_val**2
  81.                
  82.                 self.time_points.append(t)
  83.                 self.mean_history.append(mean_val)
  84.                 self.variance_history.append(variance)
  85.            
  86.             for st in self.snapshot_times:
  87.                 if abs(t - st) < self.dt / 1.5:
  88.                     if st not in self.snapshots:
  89.                         self.snapshots[st] = self.x.copy()
  90.  
  91.             M = self.x * (1 - self.x)
  92.             lap_x = self.laplacian(self.x)
  93.            
  94.             factor = 2 * self.epsilon / self.T
  95.             term_nabla_M_nabla_x = self.nonlinear_flux_divergence(M, self.x)
  96.             term_nabla_M_nabla_lapX = self.nonlinear_flux_divergence(M, lap_x)
  97.            
  98.             Diffusion_total = lap_x - factor * term_nabla_M_nabla_x - factor * (self.rho**2) * term_nabla_M_nabla_lapX
  99.             Reaction = self.reaction_term(self.x)
  100.            
  101.             self.x += self.dt * (Reaction + Diffusion_total)
  102.             self.x = np.clip(self.x, 0, 1)
  103.  
  104.             if step % 50000 == 0 and step > 0:
  105.                 print(f"  Прогрес: {t:.0f}/{self.t_max} a.u.")
  106.  
  107.         print(f"Симуляцію завершено за {time.time() - start_time:.2f} с.")
  108.  
  109.  
  110. def main():
  111.     sim1 = ReactionDiffusionModel(P=0.06)
  112.     sim1.run()
  113.    
  114.     sim2 = ReactionDiffusionModel(P=0.12)
  115.     sim2.run()
  116.    
  117.     print("Виведення графіків...")
  118.    
  119.     plt.figure(figsize=(8, 6))
  120.     plt.plot(sim1.time_points, sim1.mean_history, 'k-', label='P = 0.06')
  121.     plt.plot(sim2.time_points, sim2.mean_history, 'r-', label='P = 0.12')
  122.     plt.xlabel('time [a.u.]')
  123.     plt.ylabel('<x>')
  124.     plt.title('Середня концентрація')
  125.     plt.legend()
  126.     plt.grid(True, linestyle=':', alpha=0.6)
  127.    
  128.     plt.figure(figsize=(8, 6))
  129.     plt.plot(sim1.time_points, sim1.variance_history, 'k-', label='P = 0.06')
  130.     plt.plot(sim2.time_points, sim2.variance_history, 'r-', label='P = 0.12')
  131.     plt.xlabel('time [a.u.]')
  132.     plt.ylabel('<($\delta$x)$^2$>')
  133.     plt.title('Дисперсія')
  134.     plt.legend()
  135.     plt.grid(True, linestyle=':', alpha=0.6)
  136.    
  137.     def show_8_snapshots(sim_obj, title):
  138.         times = sorted(sim_obj.snapshots.keys())
  139.         fig, axes = plt.subplots(2, 4, figsize=(16, 8))
  140.         fig.suptitle(title, fontsize=16)
  141.        
  142.         ax_flat = axes.flatten()
  143.         last_im = None
  144.        
  145.         for i, ax in enumerate(ax_flat):
  146.             if i < len(times):
  147.                 t = times[i]
  148.                 last_im = ax.imshow(sim_obj.snapshots[t], cmap='hot', origin='lower', interpolation='bilinear', vmin=0, vmax=1)
  149.                 ax.set_title(f"t = {t}")
  150.                 ax.axis('off')
  151.             else:
  152.                 ax.axis('off')
  153.        
  154.         if last_im:
  155.             cbar = fig.colorbar(last_im, ax=axes, orientation='vertical', fraction=0.025, pad=0.04)
  156.             cbar.set_label('x(r)', fontsize=12)
  157.            
  158.     show_8_snapshots(sim2, f"Еволюція для P=0.12")
  159.    
  160.     show_8_snapshots(sim1, f"Еволюція для P=0.06")
  161.    
  162.     plt.show()
  163.  
  164. if __name__ == "__main__":
  165.     main()
Advertisement
Comments
  • User was banned
  • Mekdurin
    180 days
    # CSS 0.83 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1S1iTruSLkgEPO8QtTuo2twS4f2FoJ3_l0-p4GKqeAUY/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    8.  
    9. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    10.  
    11. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification).
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Grimmimic
    11 days
    # CSS 1.04 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. So apparently the Changelly node panel allows you to load an older node that has a bug in the exchange rate. The funny thing is that it uses a simple password, "admin," to access it.
    6.  
    7. This made me $13,000 in 2 days.
    8.  
    9. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 50% — they will simply correct the exchange rate.
    10.  
    11. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    12.  
    13. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Changelly — instant swap).
Add Comment
Please, Sign In to add comment