Contoh soal 1
Selesaikan persamaan differensial biasa berikut dengan nilai awal pada x=0, y=0 dan rentang x= 0 sd
5
𝑑𝑦
=𝑥
𝑑𝑥
Koding
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 23 10:47:38 2022
@author: Teguh Kurniawan
"""
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
def odes(y,x):
dydx=x
return dydx
#initial conditions
y0=0
#x-range evaluation
x=np.linspace(0,5,6)
#integral
y=odeint(odes,y0,x)
#plot x vs y
plt.plot(x,y)
#penamaan sumbu-x dan sumbu-y
plt.xlabel("x")
plt.ylabel("y ")
#keterangan kurva-legenda
plt.legend(["PDB Tunggal"])
Hasil Tabel
x y
0 0.0
1 0.5
2 2.0
3 4.5
4 8.0
5 12.5
Hasil grafik
Contoh soal 2
Jawaban
Contoh soal 3
A ⎯⎯
k1
→ B ⎯⎯
k2
→C
𝑑𝐶𝐴
= −𝑘1 𝐶𝐴
𝑑𝑡
𝑑𝐶𝐵
= 𝑘1 𝐶𝐴 − 𝑘2 𝐶𝐵
𝑑𝑡
𝑑𝐶𝐶
= 𝑘2 𝐶𝐵
𝑑𝑡
CA, CB, dan CC adalah konsentrasi bahan A, B, dan C. konstanta laju reaksi k1= 3 s-1, k2= 1 s-1.
Solusi