Kamal (@Kamall282) header
Kamal (@Kamall282) profile picture

Keep it simple

Nigeria
Joined March 2021
Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)Photo by Kamal (@Kamall282)
I’m currently working on designing and simulating lightweight aircraft systems. I will make a thread to explain each blocks and their functions. Like & share and tag government bodies
2
18
2
35
4,880
This time, I took backpropagation into Convolutional Neural Networks. I trained by hand, a 3×3 input image, applying a 2×2 convolution kernel, passing the result through ReLU, and tracing the gradients back to the kernel. The ReLU activation at a negative value blocks the gradient, meaning that the position contributes no update. Maths behind deep learning…
3
5
78
1,487
No bad song 😭😭😭 #AppleMusicReplay2026
4
168
Replying to @KizzDaniel
@KizzDaniel easily 🎉 See you in 2027
1
1
5
148
Back propagation in a 2-2-2-1 network with two hidden layers with tanh and sigmoid activations. I manually trained a 2-2-2-1 neural net. With just pen and paper, I derived the gradient of every weight and bias b using the chain rule; applying gradient descent and calculating a new forward pass The prediction increases from 0.5233 to 0.699 and the loss goes down by 44.8%
4
11
82
3,217
The Maths walkthrough of how Neural Networks learn. One of the most interesting things about Neural net is that they can learn from data. But what does the ‘learning’ actually mean mathematically? Yesterday, I created a numerical example of back propagation in a freeforward neural net to know what happened behind the scenes. Instead of writing code or libraries, I used Maths to derive the learning process.
3
14
125
4,722
NAFDAC needs to be decentralized, mhen! They can't win this war all the way from Abuja 💔💔
6
204
It occurred to me that whenever I drink Hollandia Yoghurt, Dudu Yoghurt, or other products in that category, my gums become bruised and swollen for days. This morning, I decided to check the NAFDAC registration numbers on some of these products, only to discover that I couldn’t find them. And it doesn’t stop there. I’ve had similar concerns about my Olive toothpaste, methylated spirit, and even Riggs perfume. @NafdacAgency
2
2
6
307
Every strictly increasing sequence is increasing but not every increasing sequence is strictly increasing. E.g 2, 2, 3, 3, 4, 4.… is increasing but not strictly increasing.
3
193
It can be analyzed with FRActional calculus
I swear everybody don mad
3
161
Solution: Let P(θ) = 𝑡𝑎𝑛 θ ∫P dθ = 𝑙𝑛 sec(θ) IF = e^ ∫P dθ IF = sec(θ) r • sec(θ) = ∫ cos² θ • sec(θ) dθ r • sec(θ) = ∫ cos(θ) dθ r sec(θ) = sin(θ) + 𝑐 r = sin(θ) • cos(θ) + c • cos(θ) Given: r(π/4) = 1 1 = sin(π/4) • cos(π/4) + c • cos(π/4) 1= 1/√2 × 1/√2 + c• 1/√2 1-1/2 = c • 1/√2 1/2 = c • 1/√2 → c = √2 /2 r = sin(θ) cos(θ) + √2/2 • cos(θ)
1
13
280
Coding the Burger Equation in MATLAB using the Method of Lines. We are to solve the 1D viscous Burger’s equ: 𝑢ₜ + 𝑢𝑢ₓ = ν𝑢ₓₓ subject to condition 𝑢(𝑥,0)= 𝑠𝑖𝑛(π𝑥) and 𝑢(0, t) = u(1, t) = 0 With the computation domain 0≦𝑥≦1 and 0<t<0.5 We are trying to calculate the velocity 𝑢 at different spatial points. We want MATLAB to approximate the function 𝑢 = 𝑢(𝑥,𝑡) We discretize the spatial variable (u) and leave time (t) as continuous %%% code % define the physical param nu = 0.01; L = 1; N = 100; h = L/(N+1); x = (1:N)'*h; %% nu = viscosity, which controls the diffusion component of Burger’s PDE L means, we are solving it on 0<x<1 N = number of interior points x will generate a spatial grid %% code tspan = linspace(0,0.5,101); % this will generate the time vector from 0 to 0.5 with 101 values % code U0 = sin(pi*x); % initial condition % call the solver options = odeset('RelTol', 1e-7, 'AbsTol', 1e-9); [t,U] = ode15s(@(t,U) burgers_rhs(t,U,h,nu), ... tspan,U0,options); % Tol will define the tolerance error for the numerical solver RelTol control relative error, AbsTol control absolute error The ode15 command is used for stiff differential equ. because the burger equ contains ν𝑢ₓ The second spatial derivative introduces terms proportional to 1/ℎ. When the spatial grid becomes finer, the resulting ODE system can become stiff. Now, we get the engine for the program The spatially discretized equation is 𝑑𝑢ᵢ/ 𝑑𝑡 = - 𝑢ᵢ(𝑢ᵢ₊₁ - 𝑢ᵢ₋₁)/2ℎ + ν (𝑢ᵢ₊₁ - 2𝑢ᵢ + 𝑢ᵢ₋₁)/ℎ² This equation is what MATLAB uses to calculate every interior grid % code function dUdt = burgers_rhs(~,U,h,nu) Ufull = [0; U; 0]; Ux = (Ufull(3:end)-Ufull(1:end-2))/(2*h); Uxx = (Ufull(3:end)-2*Ufull(2:end-1) ... +Ufull(1:end-2))/(h^2); dUdt = -U.*Ux + nu*Uxx; end %%% The name of the function is burgers_RHS, which will return the time derivatives as output The function inputs are: U = current numerical solution h = spacing, nu = viscosity coefficient From the code Ufull= [ 0; U; 0] The solution contains interior points but the finite difference formula requires their neighbors, that’s why we add the two boundaries (0;0) Ux implements the first spatial derivative Uxx implements the second dudt is the burger’s equation We’ve now transformed the burger’s equation into a system of 101 coupled ODEs After solving the ODE, we have 100 interior grid points; we must include the boundary points %% code Ufull = [zeros(length(t),1), U, zeros(length(t),1)]; xfull = linspace(0,L,N+2); %% The first line will add zero-valued boundary columns to the array of solutions. The second line reconstructs the complete spatial grid 𝑥 =0, 𝑥 =1 Then reconstruct the computational grid %%code [X,T] = meshgrid(xfull, t); % Meshgrid constructs two matrices: X = spatial grid and T is the corresponding time coordinate. This mesh matrix will allow MATLAB to pair every solution u to its spatial coordinates Now, we can visualize the solution u %% code figure; surf(X,T,Ufull); xlabel('Spatial coordinate, x'); ylabel('Time, t'); zlabel('Velocity, u(x,t)'); title('Viscous Burgers Equation - 3D Solution'); colorbar; shading interp; view(45,30); grid on; %% plot the solution at different times figure; hold on; time_indices = [1, 26, 51, 76, 101]; for k = time_indices plot(xfull,Ufull(k,:),'LineWidth',2); end xlabel('Spatial coordinate, x'); ylabel('Velocity, u(x,t)'); title('Evolution of Burgers Equation'); legend('t=0','t=0.125','t=0.25','t=0.375','t=0.5'); grid on; hold off; % I chose to do the plot because the initial surf plot gives the overall behaviour, sometimes we'll need the solution at some specific time; so I selected 5 indices
1
2
1
32
824
How to write code to numerically solve Non-linear partial differential equations. (Burger’s equation) In my next tweet, I'll use the method of Lines to simulate Burger's Partial differential equation. Timeline turn to IDE 😀
1
25
772
On the exact evaluation of the indefinite integral on [0, 1], involving arctangent. Short abstract: The note below computes the integral, where the Feynman technique changes the arctan to a parametric integral. The parameter turns the problem into a double integral. The order of the integration is changed using Lebesgue Integral. I used partial fractions and trig to reduce the inner integral to a simple form. Numerically, the closed form is approximately 0.1033
3
24
721
Short video in my live-class while I was doing some proofs on number theory Prove that: 5ⁿ -4𝑛 -1 is divisible by 16.
1
17
488
Let t = x + y dt/dx = 1 + dy/dx dy/dx = dt/dx - 1 Substitute into the differential dt/dx - 1 = sin(t) dt/dx = sin(t) + 1 dt/(sin(t) + 1) = dx Take the integral of both sides ∫dt/(sin(t)+1) = ∫ dx Focusing on the Left integral Rationalize the trig function ∫ sin(t)-1/(1- sin²t) dt = x + C By Pythagoras rule: cos²x = 1- sin²x ∫(sin(t) -1)/cos²t dt = x + C Splitting into partial fractions ∫sin(t)/cos²(t) dt - ∫ 1/cos²t dt = x + C We use u-substitution on the first integral (let u = cos t) ∫sin(t)/u² × du/-sin(t) - ∫ sec²(t) dt = x + C ∫-1/u² du - tan(t) = x + C 1/u - tan(t) = x + C 1/cos(t) - tan(t) = x + C 1/cos(x+y) - tan(x+y) = x + C
Differential equation.
2
4
24
704
Leave battery for itel Got this ITel Storm watch 8 days ago, still at 40% since last Friday. Kagan will say “stop buying Ikeja green lantern😭😭” He might be right
2
8
336
Apple Hill, Dream
1
6
195
Triangle inequality ∀ a, b ∈ ℝ | a + b ≦ | a | + | b | Proof: -| a | ≦ a ≦ | a | - | b | ≦b ≦ | b | - | a | - | b| ≦ a + b ≦ | a | + | b | -(| a| + | b| ) ≦ a + b ≦ | a | + | b | Consequently, by definition of absolute | a + b | ≦ |a | + | b|
1
11
585
Field axiom of real numbers Theorem: ∀ a ∈ ℝ a•0 = 0 Proof: Starting with the distributive property a(0+0) = a(0) + a(0) since 0+0 = 0 a(0) = a(0) + a(0) a(0)- a(0) = a(0) 0 = a(0) a(0) = 0
5
209