Theory
From verses to C#
This unit covered three documented results from classical Indian mathematics: Aryabhata's approximation of pi, the Shulba Sutras' right-triangle relationship, and Brahmagupta's area of a cyclic quadrilateral. Your syllabus asks you to do something satisfying with them: implement them in code.
Since this subject is .NET, you can write them in C#, the language you have used all semester, turning centuries-old mathematics into methods that run. This is a normal programming exercise; each result becomes a short, clear function whose output you can check against the worked examples from the earlier topics.
Theory
Aryabhata's pi
Recall the rule: add 4 to 100, multiply by 8, add 62000, giving the circumference 62832 for a diameter of 20000, so pi is about 62832 / 20000 = 3.1416.
In C# this is a direct translation. We express the documented METHOD, the specific arithmetic, rather than just reading C#'s built-in Math.PI, because the point of the exercise is to reproduce Aryabhata's calculation.
Practical
Aryabhata's approximation of pi
// Reproduce Aryabhata's documented rule for pi
static double AryabhataPi()
{
double circumference = (100 + 4) * 8 + 62000; // 104*8 + 62000 = 62832
double diameter = 20000;
return circumference / diameter; // 62832 / 20000 = 3.1416
}
// Console.WriteLine(AryabhataPi()); // 3.1416Theory
The Shulba right-triangle check and Brahmagupta's area
The Shulba Sutras' relationship is a single boolean test: given three sides, is a squared plus b squared equal to c squared? For 3, 4, 5 that is 9 + 16 = 25, which equals 5 squared, so the method returns true.
Brahmagupta's cyclic-quadrilateral area takes the four sides, forms the semi-perimeter s = (a+b+c+d)/2, and returns the square root of (s-a)(s-b)(s-c)(s-d). For sides 4, 5, 7, 10, s is 13 and the area is 36. Both translate cleanly into C#.
Practical
The right-triangle check and Brahmagupta's formula
using System;
// Shulba Sutras: is this a right triangle? a*a + b*b == c*c
static bool IsRightTriangle(int a, int b, int c)
{
return a * a + b * b == c * c;
}
// Brahmagupta: area of a cyclic quadrilateral with sides a, b, c, d
static double BrahmaguptaArea(double a, double b, double c, double d)
{
double s = (a + b + c + d) / 2; // semi-perimeter
return Math.Sqrt((s - a) * (s - b) * (s - c) * (s - d));
}
// Console.WriteLine(IsRightTriangle(3, 4, 5)); // true (9 + 16 = 25)
// Console.WriteLine(IsRightTriangle(3, 4, 6)); // false (25 != 36)
// Console.WriteLine(BrahmaguptaArea(4, 5, 7, 10)); // 36 (sqrt of 1296)Quiz
In the C# code, BrahmaguptaArea(4, 5, 7, 10) is called. What does it return, and why?
- 26, the sum of the sides
- 36, because s = 13, and the square root of (9 x 8 x 6 x 3) = the square root of 1296 = 36
- 1296, the product before the square root
- An error, because cyclic quadrilaterals cannot be computed
Show the answer
36, because s = 13, and the square root of (9 x 8 x 6 x 3) = the square root of 1296 = 36
The method computes s = (4+5+7+10)/2 = 13, then Math.Sqrt((13-4)(13-5)(13-7)(13-10)) = Math.Sqrt(9863) = Math.Sqrt(1296) = 36. Option A (26) is the perimeter, which the code does not return. Option C (1296) is the product INSIDE the square root; the method calls Math.Sqrt on it, giving 36, so it does not stop at 1296. Option D is wrong: the calculation runs fine and returns a valid number. This is the same worked result as the earlier topic (area 36), now produced by a few lines of C#, showing how the documented formula maps directly to code.
Think first
Why reproduce Aryabhata's pi when C# already has Math.PI?
C# gives you Math.PI for free. So what is the point of coding Aryabhata's specific calculation? Then tap.
Show the answer
The point is not to REPLACE Math.PI but to UNDERSTAND and REPRODUCE the historical method, and to connect the classical mathematics to your own coding skills. Implementing Aryabhata's rule forces you to follow exactly how his approximation was built, (100+4)*8 + 62000 over 20000, which deepens your grasp of both the historical result and the idea that pi is approached by approximation. It is the same educational reason you might implement a sorting algorithm by hand rather than calling a library sort: coding a method teaches the method. Using Math.PI would just hand you a number and teach you nothing about where 3.1416 came from. The exercise also demonstrates that mathematics documented many centuries ago maps cleanly onto a few lines of modern C#, a satisfying bridge across time, and it gives you practice in the language. So the goal is comprehension and connection, not efficiency. To truly understand a result, implement it yourself.
Watch out
Implementation traps
Adding sides instead of squaring: the right-triangle check is aa + bb == c*c, not a + b.
Forgetting the square root: Brahmagupta's formula needs Math.Sqrt of the product; the product alone (1296) is not the area (36).
Integer division for the semi-perimeter: use double so (a+b+c+d)/2 is not truncated; s should be 13, not risk being cut to an integer wrongly.
Reproducing vs shortcutting pi: express Aryabhata's actual arithmetic; do not just return Math.PI and call it his method.
Fabricating verse text in comments: keep comments factual; cite the method, not invented shlokas.
Theory
BCA505 complete
You have built a full ASP.NET web application concept (FestConnect) in C#, from server controls and events to data, state, configuration, and web services, and you have implemented classical Indian mathematics from Aryabhata, the Shulba Sutras, and Brahmagupta in the same language. That is the complete arc of .NET Technology. Follow your institute's own guidance for this unit; present the mathematics accurately and cite your sources. Well done.
Summary
Key takeaways
- The syllabus asks you to implement Unit 4's documented results in code; this .NET subject uses C#.
- Aryabhata's pi: (100 + 4) * 8 + 62000 = 62832, divided by diameter 20000, gives 3.1416; express the method, not just Math.PI.
- The Shulba Sutras' right-triangle check is aa + bb == c*c: IsRightTriangle(3, 4, 5) returns true (9 + 16 = 25).
- Brahmagupta's area uses s = (a+b+c+d)/2 then Math.Sqrt((s-a)(s-b)(s-c)(s-d)): BrahmaguptaArea(4, 5, 7, 10) returns 36.
- Use double (not integer) arithmetic, and remember the square root in Brahmagupta's formula.
- The value is understanding and connecting the historical mathematics to code, and practising C#, not replacing built-in functions.
- Memory hook: three documented results, three short C# methods, outputs 3.1416, true, and 36.