Implementation of all sutras of Unit-4 in computer lab using C / Python / any other programming language

Unit की mathematics running code बन जाती है: कुछ C# methods Aryabhata के pi approximation, Shulba Sutras के right-triangle check, और Brahmagupta के cyclic-quadrilateral area को reproduce करते हैं, classical results को इस subject की language से जोड़ते हुए।

11 min read · 10 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

Verses से C# तक

इस unit ने classical Indian mathematics से तीन documented results cover किए: Aryabhata का pi का approximation, Shulba Sutras का right-triangle relationship, और Brahmagupta का cyclic quadrilateral का area। आपका syllabus पूछता है आप इनसे कुछ satisfying करें: इन्हें code में implement कीजिए।

चूँकि यह subject .NET है, आप इन्हें C# में लिख सकते हैं, वह language जो आपने पूरे semester इस्तेमाल की, centuries-old mathematics को methods में बदलते हुए जो चलती हैं। यह एक normal programming exercise है; हर result एक छोटा, clear function बनता है जिसका output आप पहले के topics के worked examples के against check कर सकते हैं।

Theory

Aryabhata का Pi

Rule याद कीजिए: 100 में 4 add कीजिए, 8 से multiply कीजिए, 62000 add कीजिए, 20000 diameter के लिए circumference 62832 देते हुए, तो pi लगभग 62832 / 20000 = 3.1416 है।

C# में यह एक direct translation है। हम documented METHOD express करते हैं, specific arithmetic, सिर्फ़ C# का built-in Math.PI पढ़ने की बजाय, क्योंकि exercise का point Aryabhata की calculation reproduce करना है।

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.1416

Theory

Shulba Right-Triangle Check और Brahmagupta का Area

Shulba Sutras का relationship एक single boolean test है: तीन sides दिए गए, क्या a squared plus b squared c squared के equal है? 3, 4, 5 के लिए यह 9 + 16 = 25 है, जो 5 squared के equal है, तो method true return करता है।

Brahmagupta का cyclic-quadrilateral area चार sides लेता है, semi-perimeter s = (a+b+c+d)/2 बनाता है, और (s-a)(s-b)(s-c)(s-d) का square root return करता है। Sides 4, 5, 7, 10 के लिए, s 13 है और area 36 है। दोनों cleanly C# में translate होते हैं।

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

C# code में, BrahmaguptaArea(4, 5, 7, 10) call होता है। यह क्या return करता है, और क्यों?

  1. 26, sides का sum
  2. 36, क्योंकि s = 13, और (9 x 8 x 6 x 3) का square root = 1296 का square root = 36
  3. 1296, square root से पहले का product
  4. एक error, क्योंकि cyclic quadrilaterals compute नहीं हो सकते
Show the answer

36, क्योंकि s = 13, और (9 x 8 x 6 x 3) का square root = 1296 का square root = 36

Method compute करता है s = (4+5+7+10)/2 = 13, फिर Math.Sqrt((13-4)(13-5)(13-7)(13-10)) = Math.Sqrt(9863) = Math.Sqrt(1296) = 36। Option A (26) perimeter है, जो code return नहीं करता। Option C (1296) square root के INSIDE का product है; method इस पर Math.Sqrt call करता है, 36 देते हुए, तो यह 1296 पर stop नहीं होता। Option D wrong है: calculation ठीक चलता है और एक valid number return करता है। यह पिछले topic जैसा same worked result है (area 36), अब C# की कुछ lines से produced, दिखाते हुए documented formula directly code में कैसे map होता है।

Think first

जब C# के पास पहले से Math.PI है तो Aryabhata का Pi क्यों Reproduce करें?

C# आपको Math.PI free में देता है। तो Aryabhata की specific calculation code करने का point क्या है? फिर tap कीजिए।

Show the answer

Point Math.PI को REPLACE करना नहीं है बल्कि historical method को UNDERSTAND और REPRODUCE करना है, और classical mathematics को आपकी अपनी coding skills से connect करना है। Aryabhata का rule implement करना आपको exactly follow करने के लिए force करता है कैसे इनका approximation built हुआ, (100+4)*8 + 62000 over 20000, जो historical result और यह idea दोनों की आपकी grasp को deepen करता है कि pi approximation से approach किया जाता है। यह same educational reason है जिससे आप एक sorting algorithm हाथ से implement कर सकते हैं एक library sort call करने की बजाय: एक method code करना method सिखाता है। Math.PI इस्तेमाल करना बस आपको एक number दे देता और आपको कुछ नहीं सिखाता कि 3.1416 कहाँ से आया। Exercise यह भी demonstrate करता है कि many centuries पहले documented mathematics modern C# की कुछ lines पर cleanly map होती है, time के across एक satisfying bridge, और यह आपको language में practice देता है। तो goal comprehension और connection है, efficiency नहीं। एक result को truly समझने के लिए, इसे खुद implement कीजिए।

Watch out

Implementation Traps

Sides Squaring की बजाय Adding: right-triangle check aa + bb == c*c है, a + b नहीं।

Square Root भूलना: Brahmagupta के formula को product का Math.Sqrt चाहिए; अकेला product (1296) area (36) नहीं है।

Semi-Perimeter के लिए Integer Division: double इस्तेमाल कीजिए ताकि (a+b+c+d)/2 truncate न हो; s 13 होना चाहिए, ग़लती से एक integer में cut होने का risk नहीं।

Pi को Reproducing बनाम Shortcutting: Aryabhata की actual arithmetic express कीजिए; बस Math.PI return करके इसे इनका method मत कहिए।

Comments में Verse Text Fabricate करना: comments factual रखिए; method cite कीजिए, invented shlokas नहीं।

Theory

BCA505 Complete

आपने C# में एक पूरा ASP.NET web application concept (FestConnect) build किया, server controls और events से लेकर data, state, configuration, और web services तक, और आपने Aryabhata, Shulba Sutras, और Brahmagupta से classical Indian mathematics को same language में implement किया। यही .NET Technology का complete arc है। इस IKS unit के लिए अपने institute के निर्देश follow कीजिए; mathematics को accurately present कीजिए और अपने sources cite कीजिए। बहुत अच्छा।

Summary

Key takeaways

  • Syllabus पूछता है आप Unit 4 के documented results को code में implement करें; यह .NET subject C# इस्तेमाल करता है।
  • Aryabhata का pi: (100 + 4) * 8 + 62000 = 62832, diameter 20000 से divided, 3.1416 देता है; method express कीजिए, सिर्फ़ Math.PI नहीं।
  • Shulba Sutras का right-triangle check aa + bb == c*c है: IsRightTriangle(3, 4, 5) true return करता है (9 + 16 = 25)।
  • Brahmagupta का area s = (a+b+c+d)/2 फिर Math.Sqrt((s-a)(s-b)(s-c)(s-d)) इस्तेमाल करता है: BrahmaguptaArea(4, 5, 7, 10) 36 return करता है।
  • Double (integer नहीं) arithmetic इस्तेमाल कीजिए, और Brahmagupta के formula में square root याद रखिए।
  • Value historical mathematics को code से समझना और connect करना है, और C# practise करना है, built-in functions replace करना नहीं।
  • Memory hook: तीन documented results, तीन छोटे C# methods, outputs 3.1416, true, और 36।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Principles of Mathematics, Geometry and Triangles in Ancient Indian Knowledge

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Implementation of all sutras of Unit-4 in computer lab using C / Python / any other programming language · .NET Technology (Major-13) · Gri-Learn