Modular Arithmetic Library

Modular Arithmetic Library in C++

This library provides the basics of modular arithmetic operations:

  • Great Common Divisor (GCD)
  • Least Common Multiple (LCM)
  • Bezout solver
  • Decomposition number algorithm
  • Euler’s totient function
  • a^{b}(mod\:m)
  • Primality Test
  • Find next Prime
  • Inverse function
  • Solver for 1 equation
  • Solver for multiple equations
-GitHub repository:

Modular Arithmetic Source Code


Modular Arithmetic Article

Continue reading “Modular Arithmetic Library”

Fluid Dynamics

Navier-Stokes Equation

\rho [kg/m^3] : fluid density

\mu  [Pa\cdot s] : dynamic viscosity

\nu [N/\rho=m^2/s] : kinematic viscosity

\vec{V}=(u,v,w) [m/s] : velocity

\forall : volume

Conservation of mass

  1. For a system:

        \[ \frac{d}{dt}M_{SYS}=0 \]

  2. For a C.V. (Reynolds transport theorem):\]

    \[\frac{\partial}{\partial t}\int_{CV}{\rho d\forall}+\int_{CS}{\rho \vec{V}\cdot \hat{n} dA}=0 \]

Differential form (\delta x\delta y\delta z):

    \[ \frac{\partial}{\partial t}\int_{CV}{\rho d\forall}=\frac{\rho}{\partial t} \delta x\delta y\delta z \]

Continue reading “Fluid Dynamics”


Recurrent Neural Network (RNN), Long-Short Term Memory (LSTM) & Gated Recurrent Unit (GRU)

Is a type of artificial neural network where connections between nodes form a sequence. This allows temporal dynamic behavior for time sequence.
There are 3 types of vanilla recurrent neural network: the simple (RNN), gated recurrent unit (GRU) and long short term memory unit (LSTM).

Continue reading “RNN, LSTM & GRU”

Convolutional Neural Network (CNN)

Convolutional neural network introduction and tutorial


Convolutional neural network (CNN or ConvNet) is a type of neural network used in artificial intelligence that is commonly applied to analyzing images.

They can be considered a pre-processing compared to image classification algorithms. They have applications in image and video recognition, recommender systems, image classification, natural language processing, etc.


f^l : filter size.
p^l : padding.
s^l : stride.
n^{l-1}_H \times n^{l-1}_W \times n^{l-1}_C: input.
n^{l}_H \times n^{l}_W \times n^{l}_C: output.
n^l = \floor{\frac{n^{l-1}+2p^l-f^l}{s^l}+1}.
f^l \times f^l \times n_c^l : filter.
a^l : activation function.
n_c^l : bias.

Continue reading “Convolutional Neural Network (CNN)”