UPSC Mains · Mathematics · Paper II · अध्याय 9

संख्यात्मक विश्लेषण एवं कंप्यूटर प्रोग्रामिंग

Numerical Analysis and Computer Programming

द्विभाजन, न्यूटन-रैफ़्सन, अंतर्वेशन, संख्यात्मक समाकलन, रंगे-कुट्टा; संख्या पद्धतियाँ, बूलीय बीजगणित, लॉजिक गेट, एल्गोरिद्म और फ़्लोचार्ट।

Paper II 14 मिनट

1. अध्याय एक नज़र में

Paper II के Section B का यह खंड सबसे अधिक "गणना-आधारित" है; सही सूत्र और साफ़ तालिका से पूरे अंक मिलते हैं। सिलेबस:

  • numerical विधियाँ: algebraic और अबीजीय equations के हल: bisection, regula falsi, Newton-Raphson; linear system of equations: Gaussian elimination, Gauss-Jordan (प्रत्यक्ष), Gauss-Seidel (iterative); Newton के forward और पश्च interpolation, Lagrange interpolation।
  • numerical integration: trapezoidal नियम, Simpson के नियम, Gaussian quadrature।
  • साधारण differential equations के numerical हल: Euler और रंगे-कुट्टा विधियाँ।
  • कंप्यूटर programming: binary पद्धति; कंप्यूटर में अंकगणितीय और तार्किक operations; octal और hexadecimal पद्धतियाँ; decimal से transformation; binary संख्याओं का algebra; चिह्नित (signed) integer और real numbers का representation; Boolean algebra, truth table, logic gate; algorithm और flowchart।

2025 में Gauss-Seidel, संख्या-पद्धति transformation, truth table और DNF, Boolean simplification, interpolation polynomial और error-bound, और quadrature सूत्र का constant तथा error term पूछे गए। 2024 में Gauss-Jordan, sign-magnitude रूप, logic परिपथ, Simpson 3/8 और trapezoidal नियम, और Newton forward interpolation आए।

2. equations के roots

  • bisection विधि: f(a)f(b) < 0 ⇒ root (a, b) में; मध्य बिंदु c = (a + b)/2 लें और sign-परिवर्तन वाला आधा भाग रखें। n चरणों के बाद error ≤ (b − a)/2n; linear convergence।
  • regula falsi: x = [a f(b) − b f(a)]/[f(b) − f(a)]।
  • Newton-Raphson:
xn+1 = xn − f(xn)/f′(xn) (convergence-order 2; en+1 ≈ [f″/(2f′)]en²)
  • √N के लिए: xn+1 = ½(xn + N/xn)। f′(xn) ≈ 0 हो तो विधि विफल हो सकती है।
  • छेदक (Secant): f′ के स्थान पर अंतर-quotient; order ≈ 1.618।

3. linear system of equations

  • Gaussian elimination: उपरि-triangular रूप, फिर पश्च-substitution।
  • Gauss-Jordan: augmented matrix [A | b] को [I | x] में बदलें (pivot के ऊपर और नीचे, दोनों ओर शून्य)।
  • Jacobi: हर variable पिछले पूरे iteration के मानों से।
  • Gauss-Seidel: हर variable ज्यों ही निकले, तुरंत अगले equations में प्रयोग; सामान्यतः Jacobi से तेज़।
  • convergence की पर्याप्त शर्त: matrix कठोरतः diagonal-प्रधान (|aii| > Σj≠i|aij|)। आवश्यकता हो तो equations का क्रम बदलें।

4. interpolation

  • forward difference: Δfi = fi+1 − fi। n degree के polynomial का n-वाँ अंतर constant, (n + 1)-वाँ शून्य।
Newton forward: f(x0 + ph) = f0 + pΔf0 + [p(p − 1)/2!]Δ²f0 + [p(p − 1)(p − 2)/3!]Δ³f0 + …
Newton पश्च: f(xn + ph) = fn + p∇fn + [p(p + 1)/2!]∇²fn + …
Lagrange: P(x) = Σ fi Πj≠i(x − xj)/(xi − xj)
  • Newton विभक्त अंतर (असमान interval): P(x) = f[x0] + (x − x0)f[x0, x1] + (x − x0)(x − x1)f[x0, x1, x2] + …
  • interpolation error: f(x) − Pn(x) = [f(n+1)(ξ)/(n + 1)!] Πi=0n(x − xi)। n + 1 बिंदुओं से जाने वाला ≤ n degree का polynomial unique है।

5. numerical integration

नियमसूत्र (h = interval)शर्तसंयुक्त error
trapezoidal(h/2)[y0 + 2(y1 + … + yn−1) + yn]कोई भी n−(b − a)h²f″(ξ)/12
Simpson 1/3(h/3)[y0 + 4(विषम) + 2(सम) + yn]n सम−(b − a)h⁴f(4)(ξ)/180
Simpson 3/8(3h/8)[y0 + 3y1 + 3y2 + 2y3 + 3y4 + … + yn]n, 3 का multiple−(b − a)h⁴f(4)(ξ)/80
Gauss (2-बिंदु)∫−11f ≈ f(−1/√3) + f(1/√3)[−1, 1] परdegree 3 तक सटीक
  • Simpson के दोनों नियम cubic तक सटीक हैं; trapezoidal केवल linear तक।
  • undetermined coefficient विधि: किसी quadrature सूत्र के constant ज्ञात करने के लिए उसे f = 1, x, x², … के लिए सटीक बनाएँ। जिस पहली degree पर वह असटीक हो, उससे error term।

6. ODE के numerical हल

Euler: yn+1 = yn + h f(xn, yn) (स्थानीय error O(h²))
संशोधित Euler: yn+1 = yn + (h/2)[f(xn, yn) + f(xn+1, yn + hfn)]
RK4: k1 = hf(x, y); k2 = hf(x + h/2, y + k1/2); k3 = hf(x + h/2, y + k2/2); k4 = hf(x + h, y + k3); y1 = y0 + (k1 + 2k2 + 2k3 + k4)/6

7. कंप्यूटर programming: संख्या-पद्धतियाँ

  • decimal से आधार b: integer भाग को b से बार-बार भाग देकर शेषफल नीचे से ऊपर; भिन्न भाग को b से बार-बार गुणा कर integer अंक ऊपर से नीचे।
  • आधार b से decimal: Σ dibi (भिन्न भाग में negative powers)।
  • binary ↔ octal/hexadecimal: 3 या 4 bit के group (A = 10, …, F = 15)।
  • चिह्नित representation (n bit):
    • sign-magnitude: सबसे बायाँ bit sign (1 = negative), शेष magnitude; range −(2n−1 − 1) से +(2n−1 − 1); +0 और −0 दोनों।
    • 1 का complement: negative संख्या = सभी bit उलटें।
    • 2 का complement: 1 का complement + 1; range −2n−1 से 2n−1 − 1; एक ही शून्य; घटाव = complement का योग।
  • real numbers: चल-बिंदु (floating point) representation: sign, घातांक (exponent), अपूर्णांश (mantissa); IEEE 754 एकल परिशुद्धता 32 bit (1 + 8 + 23)।

8. Boolean algebra और logic gate

  • नियम: x + x = x, x·x = x; x + 1 = 1, x·0 = 0; x + x′ = 1, x·x′ = 0; अवशोषण x + xy = x; x + x′y = x + y।
  • De Morgan: (x + y)′ = x′y′; (xy)′ = x′ + y′।
  • सर्वसम्मति theorem (Consensus): xy + x′z + yz = xy + x′z।
  • gate: AND, OR, NOT, NAND, NOR, XOR (x ⊕ y = xy′ + x′y), XNOR। NAND और NOR सार्वत्रिक (universal) gate हैं।
  • प्रामाणिक रूप: पूर्ण वियोजनीय normal रूप (DNF / SOP, मिनटर्मों का योग: F = 1 वाली rows) और पूर्ण संयोजनीय रूप (CNF / POS, मैक्सटर्मों का product: F = 0 वाली rows)।
  • कारनॉ मानचित्र (K-map): 1 वाले आसन्न खानों (2, 4, 8) के group से simplification।
  • algorithm और flowchart: आरंभ/समाप्ति (अंडाकार), प्रक्रिया (आयत), निर्णय (हीरा), input/output (parallel चतुर्भुज); परिमितता, निश्चितता, input, output, प्रभावशीलता।

9. Master Formula Table

विषयसूत्र
bisection error≤ (b − a)/2n
Newton-Raphsonxn+1 = xn − f/f′; order 2
diagonal-प्रधानता|aii| > Σ|aij|
Newton forwardf0 + pΔf0 + p(p − 1)Δ²f0/2! + …
interpolation errorf(n+1)(ξ)Π(x − xi)/(n + 1)!
trapezoidal(h/2)[y0 + 2Σ + yn]; error −(b − a)h²f″/12
Simpson 1/3(h/3)[y0 + 4Σविषम + 2Σसम + yn]
Simpson 3/8(3h/8)[y0 + 3y1 + 3y2 + 2y3 + …]
संशोधित trapezoidal(h/2)[…] + (h²/12)(f0′ − fN′); error (b − a)h⁴f(4)/720
RK4(k1 + 2k2 + 2k3 + k4)/6
2 का complement range−2n−1 से 2n−1 − 1
De Morgan(x + y)′ = x′y′; (xy)′ = x′ + y′
बहुमत functionxyz + x′yz + xy′z + xyz′ = xy + yz + zx

10. चार्ट: F = xy + yz + zx का gate नेटवर्क

xyz ANDANDAND OR F = xy + yz + zx xyyzzx
xyz + x′yz + xy′z + xyz′ का सरल रूप "बहुमत function" है: F = 1 जब कम से कम दो input 1 हों। इसे तीन AND और एक OR gate से बनाया जाता है।

11. Mind Map

numerical analysis एवं programming
root
  • bisection, regula falsi
  • Newton-Raphson
system
  • Gauss, Gauss-Jordan
  • Jacobi, Gauss-Seidel
interpolation-integration
  • Newton, Lagrange, error
  • trapezoidal, Simpson, Gauss
ODE
  • Euler, संशोधित
  • RK4
programming
  • आधार, 2 का complement
  • Boolean, gate, flowchart

12. महत्वपूर्ण One-liners

  • Newton-Raphson की convergence-order 2; bisection की 1।
  • Gauss-Seidel के convergence की पर्याप्त शर्त: diagonal-प्रधानता।
  • Simpson 1/3 के लिए उप-interval सम; 3/8 के लिए 3 के multiple।
  • Simpson नियम cubic polynomials के लिए सटीक।
  • n degree के polynomial का (n + 1)-वाँ अंतर शून्य।
  • NAND और NOR सार्वत्रिक gate।
  • 2 के complement में एक ही शून्य; sign-magnitude में दो (+0, −0)।
  • (F)16 = (1111)2 = 15।

13. टिप्स एवं ट्रिक्स

गणना की तरकीबें
  • iterative विधियों में तालिका बनाएँ (iteration, x, y, z) और 4 decimal तक रखें; अंत में root equations में जाँचें।
  • decimal से binary के लिए पहले hexadecimal में बदलना तेज़ है (16 से भाग), फिर हर अंक को 4 bit में।
  • integration-नियम प्रश्नों में यदि सटीक मान निकल सकता है, तो उसे भी लिखें और error दिखाएँ।
याद रखने की तरकीब

Simpson 3/8 के coefficient: "1, 3, 3, 2, 3, 3, 2, …, 3, 3, 1"; Simpson 1/3: "1, 4, 2, 4, 2, …, 4, 1"।

सामान्य भूल

sign-magnitude में (8D)16 को सीधे 141 लिखना। सबसे बायाँ bit sign है, इसलिए 8 bit में (8D)16 = −13।

14. PYQ-आधारित प्रश्न एवं हल

Q1UPSC 2025 · Paper II · 5(b) · 10 अंक

Gauss-Seidel विधि से हल कीजिए: 10x + 2y + z = 9, 2x + 20y − 2z = −44, −2x + 3y + 10z = 22।

हल

system diagonal-प्रधान है (10 > 3, 20 > 4, 10 > 5)। iteration सूत्र:

x = (9 − 2y − z)/10; y = (−44 − 2x + 2z)/20; z = (22 + 2x − 3y)/10
iterationxyz
0000
10.9000−2.29003.0670
21.0513−1.99843.0098
30.9987−1.99892.9994
40.9998−2.00003.0000

x = 1, y = −2, z = 3 (जाँच: 10 − 4 + 3 = 9 ✓)।

Q2UPSC 2024 · Paper II · 5(b) · 10 अंक

Gauss-Jordan विधि से हल कीजिए: 2x + 3y − z = 5, 4x + 4y − 3z = 3, 2x − 3y + 2z = 2।

हल

[A | b] = [(2, 3, −1 | 5); (4, 4, −3 | 3); (2, −3, 2 | 2)]

  • R2 − 2R1, R3 − R1: [(2, 3, −1 | 5); (0, −2, −1 | −7); (0, −6, 3 | −3)]
  • R3 − 3R2: (0, 0, 6 | 18) ⇒ R3/6: (0, 0, 1 | 3)
  • R2 + R3, फिर ÷(−2): (0, 1, 0 | 2); R1 + R3 − 3R2, फिर ÷2: (1, 0, 0 | 1)
[I | x] = [(1, 0, 0 | 1); (0, 1, 0 | 2); (0, 0, 1 | 3)] ⇒ x = 1, y = 2, z = 3
Q3UPSC 2025 · Paper II · 5(c) · 10 अंक

(i) (3479)10 को binary और (7AE.9F)16 को decimal में बदलिए। (ii) F(x, y, z) = (x + y + z′)(x′ + y′) की truth table बनाइए और उससे पूर्ण वियोजनीय normal रूप (DNF) निकालिए।

हल

(i) 3479 = 13·256 + 9·16 + 7 = (D97)16 = (110110010111)2।

(7AE.9F)16 = 7·256 + 10·16 + 14 + 9/16 + 15/256 = 1792 + 160 + 14 + 0.5625 + 0.05859375 = 1966.62109375।

(ii) x′ + y′ = 0 केवल x = y = 1 पर; x + y + z′ = 0 केवल (0, 0, 1) पर। अतः F = 0 rows 001, 110, 111 पर, शेष पर 1।

x y z000001010011100101110111
F10111100
F = x′y′z′ + x′yz′ + x′yz + xy′z′ + xy′z

(सरल रूप: F = x′y + xy′ + x′y′z′।)

Q4UPSC 2024 · Paper II · 5(c) · 10 अंक

(i) (8D)16 और (FF)16 का sign-magnitude रूप में decimal तुल्य ज्ञात कीजिए। (ii) (9B2.1A)16 का decimal तुल्य ज्ञात कीजिए।

हल

(i) (8D)16 = 1000 1101: sign-bit 1 (negative), magnitude 000 1101 = 13 ⇒ −13। (FF)16 = 1111 1111: sign 1, magnitude 111 1111 = 127 ⇒ −127।

(ii) 9·256 + 11·16 + 2 + 1/16 + 10/256 = 2304 + 176 + 2 + 0.0625 + 0.0390625 = 2482.1015625।

Q5UPSC 2025 · Paper II · 6(b)

Boolean function F(x, y, z) = xyz + x′yz + xy′z + xyz′ का simplification कीजिए और संगत gate नेटवर्क बनाइए।

हल

xyz = xyz + xyz + xyz (x + x = x) लिखकर तीन pair बनाएँ:

  • xyz + x′yz = yz(x + x′) = yz
  • xyz + xy′z = xz
  • xyz + xyz′ = xy
F = xy + yz + zx (बहुमत function)

नेटवर्क: तीन दो-input AND gate (xy, yz, zx) और एक तीन-input OR gate (चार्ट देखें)।

Q6UPSC 2025 · Paper II · 7(b)

आँकड़ों x: 0, 1, 3; f(x): 1, 3, 55 पर ठीक बैठने वाला 2 या कम degree का unique polynomial ज्ञात कीजिए। ट्रंकेशन error का bound भी प्राप्त कीजिए।

हल

विभक्त अंतर: f[0, 1] = 2, f[1, 3] = 26, f[0, 1, 3] = (26 − 2)/3 = 8।

P(x) = 1 + 2x + 8x(x − 1) = 8x² − 6x + 1

(जाँच: P(3) = 72 − 18 + 1 = 55 ✓।) uniqueness: दो ऐसे polynomials का अंतर ≤ 2 degree का है और उसके 3 root हैं, अतः शून्य।

error: E(x) = f‴(ξ)/3! · x(x − 1)(x − 3)। g(x) = x(x − 1)(x − 3) का [0, 3] पर maximum |g| x = (4 + √7)/3 पर (20 + 14√7)/27 ≈ 2.113 है।

|E(x)| ≤ (M3/6) × 2.113 ≈ 0.352 M3, M3 = max[0,3]|f‴|
Q7UPSC 2024 · Paper II · 7(b)

f(x) = 5x³ − 3x² + 2x + 1 का x = −2 से x = 4 तक (i) h = 1 के साथ Simpson 3/8 नियम और (ii) h = 1 के साथ trapezoidal नियम से integration कीजिए।

हल
x−2−101234
f(x)−55−91533115281

(i) n = 6 (3 का multiple):

(3/8)[−55 + 3(−9) + 3(1) + 2(5) + 3(33) + 3(115) + 281] = (3/8)(656) = 246

(ii) (1/2)[−55 + 2(−9 + 1 + 5 + 33 + 115) + 281] = (1/2)(516) = 258।

सटीक मान: [5x⁴/4 − x³ + x² + x]−24 = 276 − 30 = 246। Simpson 3/8 cubic के लिए सटीक है; trapezoidal की error 12 है।

Q8UPSC 2025 · Paper II · 8(b)

quadrature सूत्र ∫x0x1f(x)dx = (h/2)(f0 + f1) + ph²(f0′ − f1′), x1 = x0 + h, के लिए constant p और error term ज्ञात कीजिए। अतः ∫abf(x)dx (a = x0 < x1 < … < xN = b) के लिए संयुक्त नियम निकालिए।

हल

x0 = 0, x1 = h लेकर सूत्र को सटीक बनाएँ:

  • f = 1, x: स्वतः सटीक (f′ term शून्य)।
  • f = x²: h³/3 = h³/2 + ph²(0 − 2h) ⇒ p = 1/12।
  • f = x³: h⁴/2 + (1/12)h²(−3h²) = h⁴/4 = सटीक ✓।
  • f = x⁴: सूत्र h⁵/2 − h⁵/3 = h⁵/6, सटीक h⁵/5; अंतर h⁵/30 = C·4!·h⁵ ⇒ C = 1/720।
error term: (h⁵/720) f(4)(ξ), x0 < ξ < x1

संयुक्त नियम: सभी उप-अंतरालों पर जोड़ने से आंतरिक derivative कट जाते हैं:

∫abf dx = (h/2)[f0 + 2(f1 + … + fN−1) + fN] + (h²/12)(f′(a) − f′(b)) + (b − a)h⁴f(4)(ξ)/720

(यह "derivative-संशोधित trapezoidal नियम" है, जो Euler-Maclaurin सूत्र का पहला संशोधन है।)

Q9UPSC 2024 · Paper II · 8(b)

Newton forward difference सूत्र से f(2.5) का अनुमान लगाइए: x: 1, 2, 3, 4, 5, 6; f(x): 0, 1, 8, 27, 64, 125।

हल

अंतर: Δ: 1, 7, 19, 37, 61; Δ²: 6, 12, 18, 24; Δ³: 6, 6, 6; Δ⁴: 0। x0 = 1, h = 1, p = 1.5।

f(2.5) = 0 + 1.5(1) + [1.5(0.5)/2](6) + [1.5(0.5)(−0.5)/6](6) = 1.5 + 2.25 − 0.375 = 3.375

(आँकड़े f = (x − 1)³ हैं; (1.5)³ = 3.375 ✓, क्योंकि Δ⁴ = 0।)

Q10अभ्यास प्रश्न · 15 अंक

Newton-Raphson विधि से x³ − 2x − 5 = 0 का वह root चार decimal स्थानों तक ज्ञात कीजिए जो 2 और 3 के बीच है।

हल

f(2) = −1, f(3) = 16; x0 = 2, f′(x) = 3x² − 2।

  • x1 = 2 − (−1)/10 = 2.1
  • f(2.1) = 0.061, f′(2.1) = 11.23 ⇒ x2 = 2.1 − 0.00543 = 2.09457
  • f(2.09457) ≈ 0.00019, f′ ≈ 11.16 ⇒ x3 ≈ 2.09455

root ≈ 2.0946।

15. Quick Revision Summary

परीक्षा से पहले एक बार ज़रूर पढ़ें
  • root: bisection, regula falsi, Newton-Raphson (order 2)।
  • system: Gauss-Jordan (augmented matrix); Gauss-Seidel (diagonal-प्रधानता, तालिका)।
  • interpolation: अंतर तालिका; Newton forward/पश्च; Lagrange; विभक्त अंतर; error-सूत्र और bound।
  • integration: trapezoidal, Simpson 1/3 और 3/8 (शर्तें, error); undetermined coefficient विधि; RK4।
  • programming: आधार-transformation; sign-magnitude और 2 का complement; Boolean नियम, DNF/CNF, gate।