Ilovepdf Merged (2)
Ilovepdf Merged (2)
Aim:To plot growth and decay model and to predict the change in quantity over
time .
Programming language used :Python
Mathematical concept
Growth and decay models are mathematical representations used to describe and
predict the changes in quantity over time .
import numpy as np
plt.xlabel('Time' + r'$\rightarrow$')
plt.ylabel('Amplitude' + r'$\rightarrow$')
plt.grid()
plt.axhline(y=0, color='k')
plt.axvline(x=0, color='k')
plt.show()
Input
Uses:
• By analyzing the plotted growth or decay model, one
can make predictions about the future behavior of a
system.
• It help in understanding how a quantity increases over
time and how a quantity decreases over time.
7.Solution of Differential Equation
Mathematical concept
A differential equation is an equation that relates a function and its derivatives. The solution is
essentially the function that, when substituted into the differential equation, makes the equation
true.
Differential equations can be categorized into ordinary differential equations (ODEs) and partial
differential equations (PDEs), depending on whether the unknown function depends on one or more
independent variables.
The process of finding a solution to a differential equation can vary based on the type of differential
equation and its complexity. Some differential equations can be solved analytically, meaning an
explicit formula for the solution can be obtained. Others may require numerical methods for
approximation.
Source code
import numpy as np
dydt = eval(ode_function_str)
return dydt
y = odeint(model, y0, t)
plt.plot(t, y, label='y(t)')
plt.xlabel('Time')
plt.ylabel('y(t)')
plt.legend()
plt.show()
Input
Uses:
• Solutions to differential equations help in understanding the
behaviour of dynamic systems. They provide insights into how
quantities change with respect to each other and to time.
• Solutions to differential equations often provide deep insights into
the underlying mathematical structure of a system.
9.SECOND ORDER SOLUTION FAMILY OF DIFFERENTIAL
EQUATION
Aim:To plot the second order solution family of Differential equation.
Mathematical concept
equation.
typically involves two arbitrary constants. The solution has the form :
y(t)=C1y1(t)+C2y2(t)
The nature of the solution depends on the roots of the characteristic equation
associated with the
equation determine the types of solutions and behaviour of the second-order ODE.
y(t)=C1e^(λ1t)+C2e^(λ2t)
y(t)=(C1+C2t)e^(λ1t)
y(t)=e^(αt)(C1cos(βt)+C2sin(βt))
SOURCE CODE
import numpy as np
t = np.linspace(0, 5, 100)
plt.figure(figsize=(8, 6))
plt.xlabel('Time (t)')
plt.ylabel('y(t)')
plt.legend()
plt.grid(True)
plt.show()
Input
Output
Uses:
(DE) can provide valuable insights into the behaviour of the system
solutions.
Observations:
➢ Implementing the solutions of wave equations in graph is crucial in the
fields of seismology, signal processing,etc,,.
➢ Using programming would help to handle complex conditions and
calculations in time effective manner
10.One – Dimensional Heat Equation
∂u/∂t=α∂2 u/∂t2
where:
The heat equation is subject to various boundary and initial conditions, which specify the behavior of
the solution.
I). Initial Condition: u(x,0)=f(x) The initial condition specifies the temperature distribution at the
initial time t=0.
II). Boundary Conditions: These conditions help determine the behavior of the solution near the
edges of the region under consideration. In the case of the heat equation, the boundaries
correspond to the spatial limits of the material or system being studied.
III). Periodic Boundary Condition:u(a,t) =u(b,t) For a domain with periodic boundary conditions, the
temperature at one boundary is equal to the temperature at the opposite boundary for all time t.
Source Code:
import numpy as np
T = float(input("Final time:"))
alpha = 0.01
x = np.linspace(0, L, N+1)
dx = L / N
M = int(T / dt)
u0 = np.sin(np.pi * x)
u_left = 0
u_right = 0
u = np.zeros((N+1, M+1))
u[:, 0] = u0
u[0, :] = u_left
u[-1, :] = u_right
plt.figure(figsize=(10, 6))
plt.xlabel('Position (x)')
plt.ylabel('Temperature (u)')
plt.legend()
plt.grid(True)
plt.show()
Input
Final time:3
Uses:
• The solution helps in predicting how the temperature evolves and understanding the
thermal behavior of the system under given constraints.