5.4.25 · D1 · HinglishScientific Computing (Python)

FoundationsImplementing root-finding from scratch — Newton-Raphson, bisection

3,361 words15 min read↑ Read in English

5.4.25 · D1 · Coding › Scientific Computing (Python) › Implementing root-finding from scratch — Newton-Raphson, bis

Parent note ki ek bhi line padhne se pehle, tumhe har woh symbol apna banana hoga jo woh tumhare samne pheinkta hai. Yeh page har ek symbol ko bilkul zero se build karta hai, is order mein jahan har idea pichle idea pe lean karta hai. Yahan koi assumption nahi ki tumne notation pehle dekha hai.


1. Function kya hoti hai? ka matlab kya hai? kya hai?

Ek curve socho jo graph paper par bani ho. Horizontal axis input carry karti hai; vertical axis height carry karti hai. Har input curve par ek height pick karta hai.

Figure s01 — "Ek function ek input ko ek height mein badle." Ek cyan curve blueprint grid par. Ek amber input value horizontal axis par dashed line se curve tak trace ki gayi hai, phir us curve se uski height vertical axis par — yeh single input-to-output mapping dikhata hai, aur white line .

Figure — Implementing root-finding from scratch — Newton-Raphson, bisection

2. Root kya hai? Star ko padhna

Graph par, ek root woh point hai jahan curve horizontal axis ko touch ya cross karti hai — kyunki axis exactly line hai ("height ," §1 se).

Figure s02 — "Root woh jagah hai jahan curve line se milti hai." Ek cyan curve jo white horizontal axis ko do amber dots par cross karti hai; har dot par label hai jisme likha hai, yeh dikhata hai ki root exactly curve aur zero line ka crossing point hai.

Figure — Implementing root-finding from scratch — Newton-Raphson, bisection

3. Subscripts:


4. Continuity — "no gaps, no jumps" property

Figure s05 — "Continuity vs ek jump." Left: ek smooth cyan curve jo ek unbroken stroke mein draw ki gayi hai (continuous — pen kabhi nahi uthta). Right: ek amber curve jo axis ke neeche se seedha upar tak jump karti hai — ek open circle neeche aur ek filled circle upar jump ko mark karte hain, ek arrow ke saath "no crossing here" note karta hai, yeh dikhata hai ki discontinuity curve ko ko touch kiye bagair skip karne deti hai.

Figure — Implementing root-finding from scratch — Newton-Raphson, bisection

5. Interval , uske endpoints, aur product

Figure s03 — "Opposite signs ek root ko bracket karte hain." Grid par ek cyan straight-through curve; amber dots left endpoint ko mark karte hain jahan (white axis ke neeche) aur right endpoint ko jahan (uske upar). Unke beech shaded band aur axis par white dot dikhata hai ki root ke andar trapped hai jab bhi endpoint heights ke opposite signs hon.

Figure — Implementing root-finding from scratch — Newton-Raphson, bisection

6. Absolute value aur "error" ka idea


7. Slope kya hai, aur derivative ?

Figure s04 — "Derivative tangent line ka slope hai." Ek cyan curve jisme ek amber tangent line use point par touch karti hai. Tangent ke neeche ek white right-triangle apna "rise" aur "run" label karta hai, aur ek annotation likhta hai — derivative ko us point par curve ki steepness ke roop mein define karta hai.

Figure — Implementing root-finding from scratch — Newton-Raphson, bisection

8. Fraction — sab kuch jod kar


9. Logarithm base 2: , ceiling , aur bisection step count


Prerequisite map

Neeche diagram dikhata hai ki yeh foundations topic ko kaise feed karte hain: plain function idea do branches mein split hoti hai (sign-tracking → bisection, slope-tracking → Newton), aur dono parent topic Root-Finding from Scratch ko feed karte hain.

Function f and output f of x

Height y and the line y = 0

Root x-star where f is zero

Continuity no jumps on all of a b

Sign of f at a point

Interval a b and product f of a times f of b

Intermediate Value Theorem

Bisection method

Slope and tangent line

Derivative f prime nonzero

Guesses x0 x1 xn xn plus 1

Newton-Raphson method

Absolute value and error en

Stopping test and tolerance

Log base 2 and ceiling and step count

Root-finding from scratch


Equipment checklist

Khud ko test karo — right side cover karo.

Main ko aloud padh sakta hoon aur keh sakta hoon iska matlab kya hai
"f of x": input machine ko do, curve se output height padho.
Main jaanta hoon aur line kya hain
vertical coordinate hai (height ); horizontal axis hai, saare points jo height zero par hain.
Main jaanta hoon kya hai
Exact true root — woh input jahan ; star bas "real answer" mark karta hai, guesses se alag.
Main aur mein subscripts decode kar sakta hoon
"Current guess" aur "next guess" ke labels; subscript ek name tag hai, power nahi.
Main par continuous function define kar sakta hoon
Woh jo poore closed interval mein pen uthaye bagair draw ki ja sake — usmein kahin bhi koi jumps ya holes nahi.
Main jaanta hoon aur uske endpoints kya hain
Left endpoint se right endpoint tak inputs ka interval; wahan heights hain.
Main jaanta hoon mujhe kya batata hai — aur uska edge case
Endpoints par opposite signs, toh continuous curve andar zero cross karti hai; lekin agar ek endpoint khud root hai toh , toh use karo ya pehle endpoints check karo.
Main Intermediate Value Theorem words mein state kar sakta hoon
Agar poore par continuous hai aur axis se neeche se upar jaati hai, toh beech mein kahin zero se zaroor guzarni padegi.
Main jaanta hoon aur ka matlab kya hai
guess aur true root ke beech gap ki size hai; "close enough" tolerance hai jahan hum rokте hain.
Main slope aur tangent line explain kar sakta hoon
Slope = rise over run; tangent woh straight line hai jo curve ki direction se ek point par match karti hai.
Main jaanta hoon kya hai aur kahan se aata hai
Derivative: ek aur machine jo par curve ki steepness (tangent slope) deti hai; jaise ke liye yeh hai.
Main Newton step ki precondition jaanta hoon
Step tabhi valid hai jab ; flat tangent matlab divide-by-zero aur koi crossing nahi.
Main samajhta hoon Newton mein kyun aata hai
Yeh height divided by slope hai = axis tak reach karne ke liye tangent ke along horizontal run.
Main ceiling ke saath bisection step count derive kar sakta hoon
Width halve hokar ban jaati hai; error deta hai (round up, kyunki steps whole numbers hain).