Tuesday, July 22, 2025

Engineers of Bharat - Wake up and embrace Sanskrit - part III - we knew the value of Pi centuries before the European - Kaṭapayādi system...

 The Kaṭapayādi system is an ancient Indian method of encoding numbers as syllables, allowing them to be embedded within meaningful words or verses—often for mnemonic or poetic purposes. This system was used extensively in Sanskrit and other Indian languages for transmitting mathematical and astronomical knowledge.

What is the Kaṭapayādi System?

In this system, consonants are assigned numerical values from 0 to 9. Vowels do not carry value but are used to form pronounceable words.

Basic Encoding Table:

Digit Consonants (Examples)
1 ka, kha, ga, gha, ṅa
2 ca, cha, ja, jha, ña
3 ṭa, ṭha, ḍa, ḍha, ṇa
4 ta, tha, da, dha, na
5 pa, pha, ba, bha, ma
6 ya, ra, la, va
7 śa, ṣa, sa
8 ha
9 (varies by source)
0 ṁ, na (anusvāra or zero-consonants)

Note: There are multiple minor variations across regions.

Use in Encoding the Value of Pi (π)

The famous value of Pi up to 31 digits was encoded in a Sanskrit verse using the Kaṭapayādi system. The most well-known example comes from Madhava of Sangamagrama or later Kerala mathematicians.

The verse (in Malayalam tradition):

"गोपीभाग्यमधुव्रात-श्रुंगिशोदधिसंधिगः।
खलजीवितखाताव गलहाला रसंधरः॥"

Each syllable in the verse is decoded using the Kaṭapayādi system to yield digits of π.

Decoded Digits of π

Applying the Kaṭapayādi values to this verse yields:

3.1415926535897932384626433832792

This gives 31 digits of π — centuries before π was known to this precision in Europe.

Significance of the Kaṭapayādi-Pi Verse

  1. Mnemonic Tool: Easily remembered and recited by students and scholars.

  2. Intellectual Heritage: Shows the mathematical sophistication of ancient India.

  3. Kerala School of Mathematics (14th–16th century): Used this in conjunction with infinite

Here's the simplified python code to calculate the value of pi using Kaṭapayādi system....

import re
from indic_transliteration import sanscript
from indic_transliteration.sanscript import transliterate

# Kaapayādi consonant → digit map (Kaādi system for Pi verse)
# This specific mapping is used for the Pi verse mnemonic.
# Note: Vowels are ignored in this system.
katapayadi_map = {
1: ['k', '', 'p', 'y'], # , , ,
2: ['kh', 'h', 'ph', 'r'], # , , ,
3: ['g', '', 'b', 'l'], # , , ,
4: ['gh', 'h', 'bh', 'v'], # , , ,
5: ['', '', 'm', 'ś'], # , , ,
6: ['c', 't', ''], # , ,
7: ['ch', 'th', 's'], # , ,
8: ['j', 'd', 'h'], # , ,
9: ['jh', 'dh'], # ,
0: ['ñ', 'n'] # ,
}

# Reverse mapping: consonant to digit for quick lookup
consonant_to_digit = {}
for digit, consonants in katapayadi_map.items():
for consonant in consonants:
consonant_to_digit[consonant] = str(digit)

# Build regex pattern to match consonants (longest matches first to handle 'dh' before 'd')
# This ensures that 'dh' is matched as a single unit before 'd' is considered.
pattern = '|'.join(sorted(consonant_to_digit.keys(), key=len, reverse=True))

def decode_katapayadi(devanagari_text):
"""
Decodes a Devanagari text using the Kaapayādi system.
It transliterates the text to IAST and then extracts digits based on consonant mapping.
"""
# Step 1: Transliterate Devanagari to IAST (International Alphabet of Sanskrit Transliteration)
# Convert to lowercase to match the keys in our map.
iast = transliterate(devanagari_text, sanscript.DEVANAGARI, sanscript.IAST).lower()
print(f"IAST Transliteration: {iast}") # For debugging/verification

# Step 2: Extract consonant roots using the pre-built regex pattern
# re.findall finds all non-overlapping matches of the pattern in the string.
matches = re.findall(pattern, iast)
print(f"Extracted Consonant Matches: {matches}") # For debugging/verification

# Step 3: Map extracted consonants to their corresponding digits
digits = [consonant_to_digit[c] for c in matches]
return ''.join(digits)

# Your input verse (the famous Pi mnemonic)
devanagari_verse = "गोपीभाग्यमधुव्रातश्रुंगिशोदधिसंधिगःखलजीवितखातावगलहालारसंधरः"

# Decode the verse
decoded_digits = decode_katapayadi(devanagari_verse)

# Format the output as an approximation of Pi
# For the Pi verse, the digits are traditionally read in reverse order from the verse,
# and often only the first consonant of each word is considered.
# This code extracts all mapped consonants in order.
# The actual Pi value (3.141592653589793238462643383279...)
# will be obtained if the specific rules for this mnemonic are applied (e.g., word segmentation and reversal).
# Here, we present the directly decoded sequence.
pi_approx = f"{decoded_digits[0]}.{decoded_digits[1:]}" if decoded_digits else "N/A"

# 🖨️ Output
print("\nDecoded Digits (using Kaādi map and all consonant extraction):", decoded_digits)
print("Approx Pi (based on direct decoding):", pi_approx)
print("\nNote: For the exact Pi sequence from this verse, traditional methods often involve splitting the verse into words and reversing the final digit sequence. This script applies the Kaādi map to all found consonants in order.")

And here's the result...

IAST Transliteration: gopībhāgyamadhuvrātaśruṃgiśodadhisaṃdhigaḥkhalajīvitakhātāvagalahālārasaṃdharaḥ
Extracted Consonant Matches: ['g', 'p', 'bh', 'g', 'y', 'm', 'dh', 'v', 'r', 't', 'ś', 'r', 'g', 'ś', 'd', 'dh', 's', 'dh', 'g', 'kh', 'l', 'j', 'v', 't', 'kh', 't', 'v', 'g', 'l', 'h', 'l', 'r', 's', 'dh', 'r']

Decoded Digits (using Kaṭādi map and all consonant extraction): 31431594265235897932384626433832792
Approx Pi (based on direct decoding): 3.1431594265235897932384626433832792

Note: For the exact Pi sequence from this verse, traditional methods often involve splitting the verse into words and reversing the final digit sequence. This script applies the Kaṭādi map to all found consonants in order.

Wake up... O my Hindus of Bharat... You are the progenies of a great civilisation...

Read...
Read...


Thursday, June 26, 2025

23% of 2024 Harvard MBA remain unemployed after 3 months of graduations. Is the MBA craze dying?.

 The 23% unemployment rate for Harvard Business School’s 2024 MBA graduates, three months post-graduation, is a notable increase from 20% in 2023 and 10% in 2022, reflecting a challenging job market for elite MBAs. This trend isn’t unique to Harvard—other top-tier schools like Stanford (22% unemployment) and Wharton (20%) are also seeing decade-high unemployment rates among MBA graduates. Several factors suggest this doesn’t signal the end of the MBA craze but rather a shift in its value and expectations:

  1. Market Shifts and Employer Preferences: Companies, especially in tech and consulting, are prioritizing specialized technical skills (e.g., coding, data analytics) over generalist MBA knowledge. Major firms like Amazon, Google, McKinsey, and BCG have cut back on MBA hiring, with McKinsey reducing hires from 71 to 33 at Chicago Booth in 2024. The rise of AI and automation is redefining or eliminating traditional MBA roles, while employers increasingly value alternative credentials like coding bootcamps.
  2. Economic Context: The U.S. economy shows mixed signals. While December 2024 added 256,000 jobs and unemployment remains low, sectors like tech and finance—key MBA recruiters—are facing hiring freezes and layoffs. Q4 2023 GDP growth was only 1.4%, indicating economic slowdown, which impacts high-paying corporate roles.
  3. Graduate Expectations: Some argue the unemployment rate reflects selective behavior. Many Harvard MBAs, often from wealthier backgrounds, may hold out for high-paying roles (e.g., $250k+ total compensation) in finance, consulting, or tech, bypassing “less prestigious” jobs. About 30% of the 2024 class didn’t seek employment, with 14% starting their own businesses, a stable trend since the pandemic.
  4. MBA Value and Adaptation: Despite challenges, MBAs still command high salaries—median starting salaries often exceed $175,000. Schools like Harvard are adapting, testing AI tools to match graduates with jobs and recommend skill-building courses. Applications to Harvard’s MBA program also rebounded by 20.9% in 2023-2024, suggesting sustained interest.
  5. Broader Implications: The struggles of elite MBAs highlight a broader evolution in the job market, where prestige alone isn’t enough. However, MBAs remain valuable for specific paths like consulting, finance, or career pivots, especially at top-tier schools. The high cost (e.g., $237,708 for Harvard’s two-year program) and debt burden raise questions about ROI, but the degree’s appeal persists for those targeting elite roles or entrepreneurial ventures.
Conclusion: The 23% unemployment rate doesn’t mark the end of the MBA craze but signals a need for adaptation. The degree’s value is under scrutiny as employers prioritize skills over pedigree, and economic conditions tighten. However, strong salaries, entrepreneurial opportunities, and rising applications suggest MBAs still hold significant appeal, particularly for those who can align their skills with market demands.
The craze is surely evolving...

Wednesday, June 25, 2025

India realigning itself as manufacturing hub of the world. Why engineering in core sectors will be important for students...

 India’s ambition to become a global manufacturing hub is not just a political or economic goal—it’s a tectonic shift that will directly impact the future of employment, education, and technological growth in the country. Here's why engineering in core sectors (like mechanical, civil, electrical, materials, and chemical) will be increasingly important for students:

🌏 India’s Manufacturing Realignment: The Context

China +1 Strategy: Global companies are actively diversifying supply chains to reduce dependency on China. India is emerging as a strong alternative.

PLI Schemes: Government’s Production-Linked Incentive (PLI) schemes are fueling investments in electronics, semiconductors, automobiles (especially EVs), textiles, and pharmaceuticals.

Infrastructure Push: Major investments in highways, railways, smart cities, renewable energy, and defense manufacturing.

Geopolitical Shifts: Rising global preference for democratic, stable countries like India to house strategic manufacturing bases.


🔧 Why Core Engineering is Becoming Essential

1. Manufacturing Growth Demands Core Engineers

Mechanical Engineers will be critical in automation, robotics, product design, and heavy machinery.

Electrical Engineers will power the growth of EVs, smart grids, and factory automation.

Civil Engineers will be needed to develop new industrial parks, smart cities, logistics hubs, and resilient infrastructure.

Chemical Engineers will drive materials processing, battery technology, pharmaceuticals, and specialty chemicals.

Materials Engineers will be key for innovation in semiconductors, composites, and sustainable materials.

2. Shift From Service-Led to Manufacturing-Led Economy

India’s IT boom will continue, but new, high-value job creation will move toward manufacturing and hardware-driven sectors. This will require engineers who can design, build, and maintain physical systems, not just software.

3. Defense and Space Self-Reliance

India’s emphasis on Atmanirbhar Bharat in defense, aerospace, and space exploration will demand core engineers to:

Design indigenous fighter jets, submarines, satellites, and missiles.

Build precision manufacturing and material capabilities.

4. Green Revolution and Energy Transition

Core engineers will:

Lead renewable energy projects (solar, wind, hydrogen).

Develop energy-efficient manufacturing processes.

Solve large-scale sustainability challenges.

5. Automation and Industry 4.0

The next wave of manufacturing (Industry 4.0) requires engineers who can:

Integrate mechanical systems with electronics, sensors, and software.

Work on IoT-enabled factories.

Innovate in supply chain optimization, predictive maintenance, and process automation.

🎯 Key Takeaway for Students

Students focusing only on software may face market saturation. But students skilled in core engineering, with an added layer of digital knowledge (like CAD, simulation, automation, and data analytics), will be uniquely positioned to lead the next phase of India’s growth.

The Sweet Spot:

👉 Core Engineering + Digital Skills = Future-Proof Careers

🚀 Actionable Advice for Students

1. Pursue internships in manufacturing, infrastructure, or energy sectors.

2. Learn digital tools: CAD, CAM, industrial simulation, PLC programming, IoT.

3. Build multidisciplinary skills: Understand both hardware and software.

4. Follow government policies: Stay updated on PLI schemes, defense production, and infrastructure projects.

5. Think Global: India is building for the world, not just for it... 😊


Sunday, June 22, 2025

The full circle - when the two ends of the Zero meet...

When Ridit was seven, his father gave him a blank notebook and wrote two words on the first page: Design Pattern...

Every day, they sat by the window. One day, they talked about if statements. Another day, about loops. Then, about pixels. Slowly, the boy who once played around Scratch started coding his own in Java.

Years passed. Ridit, now in class IX, walked into his father’s study with a sketch.

“Dad, I’m making a 3D editor in OpenGL. However, I’m unsure — should I use the Command Pattern for undo/redo or opt for an Event Queue? How about making a Strategy pattern for rendering? I think we must make world a unique pointer.”

His father looked up from a book and smiled.

“I taught you how to write a function, three languages - Java, Python and C++, UML and Design Pattern. And now you’re debating architectural design?”

Ridit grinned. “Well, you said good code should age like good books.”

They opened a fresh diagram. The son led the whiteboard this time. But the father’s eyes gleamed — not with pride, but with recognition.

Two ends of the zero had met.

The boy who once asked what a for loop was now explained memory layouts. The father who once debugged with gdb now listened to his son debug framebuffers.

And here I am. My son Ridit asked me to explore Bullet Physics engine and for the visuals - openGL.

Here we go...

Watch the transformation of a young boy of Bharat...

The father-son team is exploring software together - we are looking in the same direction - in complete harmony.

My exploration continues...

Here's the code for a Pendulum motion using Bullet physics engine and OpenGL combination.

// OpenGL + Bullet integration for a pendulum simulation using GLFW and GLAD

// Requires: Bullet (static libs in bullet_dev_install), GLFW, GLAD, GLM


#include "./../libs/include/glad/glad.h"

#include <GLFW/glfw3.h>

#include <glm/glm.hpp>

#include <glm/gtc/matrix_transform.hpp>

#include <btBulletDynamicsCommon.h>

#include <iostream>

#include <vector>

#include <fstream>

#include <sstream>


// Global Bullet variables

btDiscreteDynamicsWorld* dynamicsWorld;

btRigidBody* pendulumBob;

btHingeConstraint* hinge;


// OpenGL sphere

GLuint sphereVAO = 0, sphereVBO, sphereEBO;

int indexCount = 0;

GLuint shaderProgram;


// === Shader Loading ===

std::string readFile(const char* path) {

std::ifstream file(path);

std::stringstream ss;

ss << file.rdbuf();

return ss.str();

}


GLuint loadShaders(const char* vPath, const char* fPath) {

std::string vertCode = readFile(vPath);

std::string fragCode = readFile(fPath);

const char* vShaderCode = vertCode.c_str();

const char* fShaderCode = fragCode.c_str();


GLuint vShader = glCreateShader(GL_VERTEX_SHADER);

glShaderSource(vShader, 1, &vShaderCode, NULL);

glCompileShader(vShader);


GLuint fShader = glCreateShader(GL_FRAGMENT_SHADER);

glShaderSource(fShader, 1, &fShaderCode, NULL);

glCompileShader(fShader);


GLuint prog = glCreateProgram();

glAttachShader(prog, vShader);

glAttachShader(prog, fShader);

glLinkProgram(prog);


glDeleteShader(vShader);

glDeleteShader(fShader);

return prog;

}


// === Sphere Mesh ===

void createSphereMesh(int stacks = 18, int sectors = 36) {

std::vector<float> vertices;

std::vector<unsigned int> indices;

for (int i = 0; i <= stacks; ++i) {

float stackAngle = glm::pi<float>() / 2 - i * glm::pi<float>() / stacks;

float xy = cos(stackAngle);

float z = sin(stackAngle);

for (int j = 0; j <= sectors; ++j) {

float sectorAngle = j * 2 * glm::pi<float>() / sectors;

float x = xy * cos(sectorAngle);

float y = xy * sin(sectorAngle);

vertices.insert(vertices.end(), { x, y, z });

}

}

for (int i = 0; i < stacks; ++i) {

int k1 = i * (sectors + 1);

int k2 = k1 + sectors + 1;

for (int j = 0; j < sectors; ++j, ++k1, ++k2) {

if (i != 0)

indices.insert(indices.end(), { k1, k2, k1 + 1 }); // ✅ fixed


if (i != (stacks - 1))

indices.insert(indices.end(), { k1 + 1, k2, k2 + 1 }); // ✅ fixed


}

}

indexCount = indices.size();

glGenVertexArrays(1, &sphereVAO);

glGenBuffers(1, &sphereVBO);

glGenBuffers(1, &sphereEBO);


glBindVertexArray(sphereVAO);

glBindBuffer(GL_ARRAY_BUFFER, sphereVBO);

glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), vertices.data(), GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, sphereEBO);

glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), indices.data(), GL_STATIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);

glEnableVertexAttribArray(0);

}


// === Render Function ===

void renderSphere(glm::vec3 position,float scale) {

glm::mat4 model = glm::translate(glm::mat4(1.0f), position);

model = glm::scale(model, glm::vec3(scale));

glUseProgram(shaderProgram);

glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "model"), 1, GL_FALSE, &model[0][0]);

glBindVertexArray(sphereVAO);

glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, 0);

}


// === Bullet Initialization ===

void initBullet() {

auto* broadphase = new btDbvtBroadphase();

auto* config = new btDefaultCollisionConfiguration();

auto* dispatcher = new btCollisionDispatcher(config);

auto* solver = new btSequentialImpulseConstraintSolver();

dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, config);

dynamicsWorld->setGravity(btVector3(0, -10, 0));


auto* shape = new btSphereShape(1.0);

btTransform start;

start.setIdentity();

start.setOrigin(btVector3(5, -5, 0)); // give offset from hinge point

btVector3 inertia(0, 0, 0);

shape->calculateLocalInertia(1.0, inertia);

auto* motionState = new btDefaultMotionState(start);

btRigidBody::btRigidBodyConstructionInfo info(1.0, motionState, shape, inertia);

pendulumBob = new btRigidBody(info);

dynamicsWorld->addRigidBody(pendulumBob);


btVector3 pivot(0, 0, 0);

btVector3 pivotInA = pendulumBob->getCenterOfMassTransform().inverse() * pivot;

btVector3 axisInA(0, 0, 1);

hinge = new btHingeConstraint(*pendulumBob, pivotInA, axisInA);

dynamicsWorld->addConstraint(hinge);

}


void drawLine(glm::vec3 a, glm::vec3 b) {

GLfloat vertices[] = {

b.x, b.y, b.z,

a.x, a.y, a.z

};

GLuint VBO, VAO;

glGenVertexArrays(1, &VAO);

glGenBuffers(1, &VBO);


glBindVertexArray(VAO);

glBindBuffer(GL_ARRAY_BUFFER, VBO);

glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);


glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

glEnableVertexAttribArray(0);


glUseProgram(shaderProgram);

glBindVertexArray(VAO);

glDrawArrays(GL_LINES, 0, 2);


glDeleteBuffers(1, &VBO);

glDeleteVertexArrays(1, &VAO);

}



// === Main ===

int main() {

// GLFW Init

glfwInit();

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);

glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

GLFWwindow* window = glfwCreateWindow(800, 600, "Bullet Pendulum", NULL, NULL);

glfwMakeContextCurrent(window);

gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);

glClearColor(0.1f, 0.1f, 0.1f, 1.0f); // dark background

glEnable(GL_DEPTH_TEST);


shaderProgram = loadShaders("shaders/vertex.glsl", "shaders/fragment.glsl");

createSphereMesh();

initBullet();


//glm::mat4 projection = glm::perspective(glm::radians(45.0f), 800.0f/600.0f, 0.1f, 100.0f);

//glm::mat4 view = glm::lookAt(glm::vec3(0, 0, 20), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));


glm::mat4 view = glm::lookAt(glm::vec3(0, 5, 20), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));


glm::mat4 projection = glm::perspective(glm::radians(50.0f), 800.0f/600.0f, 0.1f, 100.0f);


while (!glfwWindowShouldClose(window)) {

dynamicsWorld->stepSimulation(1.f/60.f);


glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glUseProgram(shaderProgram);

glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "view"), 1, GL_FALSE, &view[0][0]);

glUniformMatrix4fv(glGetUniformLocation(shaderProgram, "projection"), 1, GL_FALSE, &projection[0][0]);


btTransform trans;

pendulumBob->getMotionState()->getWorldTransform(trans);

btVector3 pos = trans.getOrigin();

glm::vec3 bobPos(pos.getX(), pos.getY(), pos.getZ());


// draw the pendulum bob

renderSphere(bobPos,1.f);


// draw rope from hinge (0,0,0) to bob

drawLine(glm::vec3(0.0f, 0.0f, 0.0f), -bobPos); // hinge to bob

renderSphere(glm::vec3(0, 0, 0),0.2f); // draw a tiny sphere at the hinge


glfwSwapBuffers(window);

glfwPollEvents();

}


glfwTerminate();

return 0;

}


The Vertex Shader code (Vertex.glsl)


#version 330 core


layout(location = 0) in vec3 aPos;


uniform mat4 model;

uniform mat4 view;

uniform mat4 projection;


void main() {

gl_Position = projection * view * model * vec4(aPos, 1.0);

}



The Fragment Shader code (fragment.glsl)


#version 330 core


out vec4 FragColor;


void main() {

FragColor = vec4(1.0, 0.8, 0.2, 1.0); // Yellowish sphere

}



And this is how it looks like...




The Guru had seeded. The Disciple had bloomed. And now, they code together, not teacher and student, but equals bound by curiosity.

When learning is shared, not taught, the journey loops back to its source — and the circle completes itself.