Implementation of Preprocessor in C Programming

Q. Write macro definitions with arguments for calculation of area and perimeter of a triangle, a square and a circle. Store these macro definitions in a file called "areaperi.h". Include this file in your program, and call the macro definitions for calculating area and perimeter for different triangles, squares and circles.

Step 1: Create a header file (.h) declaring the prototypes of required functions.

float area1(int, int, int); // for triangle
int area2(int); // for square
float area3(float); // for circle

float perimeter1(int, int, int); // for triangle
int perimeter2(int); // for square
float perimeter3(float); // for circle

Step 2: Create a C programming file (.c) defining those functions.

#include<stdio.h>
#include<math.h>
#define PI 3.1416

float perimeter1(int a, int b, int c) // for triangle
{
    return a+b+c;
}

int perimeter2(int a) // for square
{
    return 4*a;
}

float perimeter3(float r) // for circle
{
    return 2*PI*r;
}

float area1(int a, int b, int c) // for triangle
{
    float s = perimeter1(a, b, c)/2;
    return sqrt(s*(s-a)*(s-b)*(s-c));
}

int area2(int a) // for square
{
    return pow(a,2);
}

float area3(float r) // for circle
{
    return PI*r*r;
}

Step 3: Write your C program (.c) including the areaperi.h file as #include "areaperi.h".

Standard AM, FM and PM Equations

Standard Mathematical Equations for AM, FM and PM

1. Amplitude Modulation (AM)

  • : Carrier amplitude, : Carrier frequency
  • :  Message signal amplitude, : Message signal frequency
  • : Modulation index
  • : Carrier Power, : Sideband Power, : Total Power
  • : Efficiency
  • : Bandwidth of the AM signal

Amplitude Modulation

Q. The equation of amplitude modulated wave is given by s(t) = 40[1+0.8cos(2π ×10^3t)]cos(4π×10^5t). Find the carrier power, the total sideband power and bandwidth of the signal. The value of resistor given is 30Ω.
Solution: Here,

We are given:

s(t)=40[1+0.8cos(2π103t)]cos(4π105t)

And:

  • Load resistance R=30ΩR = 30\, \Omega

Step 1: Identify the standard AM form

Standard AM wave:

s(t)=Ac[1+μcos(2πfmt)]cos(2πfct)

From the given equation:

  • Ac=40A_c = 40

  • μ=0.8

  • fm=103=1kHz

  • fc=4π1052π=2×105=200kHz

a) Carrier Power PcP_c

Pc=Ac22R=402230=160060=26.67W​

Machine Learning

Mathematics for ML:

1. Statistics & Probability
Populations & Sampling
Mean, Median, Mode & Expected Values
Variance & Covariance
Random Variables
Common Probability Distributions (normal, binomial & uniform)
Central Limit Theorem
Conditional Probability
Bayes’ Theorem
Maximum Likelihood Estimation (MLE)
Linear & Logistic Regression

2. Linear Algebra
Scalars, Vectors, Matrices & Tensors
Matrix Operations (Addition, Subtraction, Multiplication, Transpose, Determinant & Inverse)
Matrix Rank & Linear Independence
Eigenvalues & Eigenvectors
Matrix Decompositions (e.g., SVD)
Principal Component Analysis (PCA)

3. Calculus
Derivatives & Gradients
Gradient Descent Algorithm
Vector/Matrix Calculus (Jacobian, Hessian)
Chain Rule
Fundamentals of Optimisation (Local vs. Global Minima, Saddle Points & Convexity)

Data Science

Coming Soon..