भारत · ग्रहगणित
स्थान उज्जयिनी Ujjayinī · change it on a tool⌕ search the कोश ⌘Kप्रहर — · —:—:—ours, from sunriseउज्जयिनी —:—:—UTC + λ/15 h, λ = 75.7682° E (D13)IST Error −26.9 minlocal mean time − IST = 4λ − 330 min (K12)engine 3f94072the site ↗

yantra/patha/yantra.js

यन्त्र: the instruments, on the owner's latitude and the text's own Sun.

971 lines · 0 exports

लेख · the header

The header, as the file states it

yantra.js — यन्त्र: the instruments, on the owner's latitude and the text's own Sun. Every instrument here is a factory: give it the owner's place (site = { latitude | palabha, deshantara }) and the owner's own sizes, and it returns (1) its construction for that latitude, (2) its graduation — where each mark goes, in the instrument's own length unit, (3) the reading the text predicts for a Kali day and time, and (4) the inverse: a reading back to the hour angle (ghaṭī and asus), the declination, the altitude and the azimuth, ready for the ledger. THE ARITHMETIC. Only the text's tiers: sphuta.js's R-sine on R = 3438 (Mādhava's by default, the 24-entry table by withSine("table")), its arc (2.33), and the mūla (square root). No spherical trigonometry of the language is called. - An angle from two legs is the text's bhuja-koṭi-karṇa: the arc of the smaller leg × R ÷ the karṇa (2.33), so that no arc is ever read where the sine is flat. - An arc's length on a circle of radius r is r × (minutes) ÷ ρ, where ρ is the radius measured in minutes of its own arc: Mādhava's 3437′44″48‴ with his sine, the text's 3438 with its table (2.17-2.22: the 24th sine is the radius). A chord is 2r × jyā(half the arc) ÷ R. No value of the circumference-to-diameter ratio is typed in anywhere. - The body's direction in the horizon frame (R-units) is the text's own quantities: the śaṅku of 3.34b-3.36 (with antyā × dyujyā ÷ R written out as dyujyā + kṣitijyā), north = agrājyā − śaṅkutala (3.27b, 3.23b-3.24), and east = dyujyā × jyā(nata) ÷ R. The inverse is the same rotation by the latitude, through akṣajyā and lambajyā (3.13). THE SKY (the forward model). The Sun is sphuta.js's true Sun, sāyana by the text's ayanāṃśa (3.9-3.10); its declination is 2.28's krānti rule on 1397 (ss-udaya.js); its hour angle is the turn: the meridian's asus (the mean Sun's turn, ss-grahana.js) less the Sun's right ascension by 3.42 at its own point (ss-udaya.js). A junction star (ch.8) is its dhruvaka with the ayanāṃśa (its polar longitude) and its declination with the vikṣepa (2.58, 2.63), as vedha-lekha.js. Time t is the engine's: days since the Kali epoch, midnight at Laṅkā. The place is northern (3.14: the akṣa is south). THE SŪRYA-SIDDHĀNTA'S INSTRUMENTS (chapter 13, the edition's numbering, editions/surya-siddhanta-full-edition.html): śaṅku 13.20 names it; its whole use is chapter 3 — wrapped from ss-chaya.js [text] kapālaka 13.23: a copper vessel with a hole beneath sinks sixty times in an ahorātra (13.21 names the kapāla among the time-instruments); one sinking is one nāḍī of the TURN (1.11-1.12) [text] gola-yantra 13.3-13.17: the sphere on its axis (13.4), rings of 180 aṅgulas — the degrees as aṅgulas, halved (13.5) — the diurnal circles at their declinations, halved (13.6-13.7), the ecliptic (13.10-13.12), the antyā (13.14), the cara (13.15), turned by a flow as the instrument of time's turning (13.16), with tuṅga and bīja (13.17) [text; reading] named only yaṣṭi, dhanus, cakra, the chāyā-yantras (13.20); toya-yantra, mayūra, nara, vānara, the thread-and- sand vessels (13.21); nara-yantra (13.24). The verses name them and give no geometry, so none is built. JAI SINGH II'S OBSERVATORIES. No verse of the Yantra-prakāra or the Samrāṭ-siddhānta is available in this repository, so none is quoted; that these are his instruments, and what each was for, is [unverified] here. The geometry of each is derived from the sphere [theorem] and tested against it. No dimension of any real instrument at Jaipur, Delhi or Ujjain is known here: every size is the owner's parameter (DEMO's sizes are "demo, not a measurement"). samrat gnomon whose hypotenuse lies along the axis; its triangle IS the equinoctial shadow triangle 12 : palabhā : akṣakarṇa (3.12b-3.13); quadrants in the equator's plane graduated in nata; the declination on the hypotenuse at r × tan δ from the quadrants' centre nadivalaya a dial in the equator's plane, a pin on each face: the face lit is the gola (the sign of δ), the pin's shadow turns with the hour angle jaya-prakasha a hemispherical bowl, cross-wires at the rim: the wires' shadow is the sky inverted kapala-yantra the same hemisphere [reading] rama a cylinder with a central pillar: altitude on the floor or the wall, azimuth by bearing digamsha a circular wall round a pillar: azimuth shashthamsha a sixty-degree arc in the meridian under a pinhole: the noon zenith distance and, the latitude known, the declination dakshinottara-bhitti a meridian wall with quadrants under a pin: the meridian altitude rashivalaya twelve gnomons, each along the ecliptic's pole at the moment its sign's first point is on the meridian: that moment, and the Sun's longitude read straight off its quadrant unnatamsha a vertical ring turning on a vertical axis: the altitude THE LEDGER. A reading is written in the instrument's own graduation (a nata in ghaṭī-vināḍī-prāṇa, an arc in aṃśa-kalā-vikalā), never as a modern coordinate. The śaṅku feeds madhyahna / vishuvat / ayananta / ishta, the bowl feeds kapala, a star on the meridian read on the wall or the ring feeds yamyottara (vedha-lekha.js's kinds); every other reading feeds the kind "yantra", which vedha-lekha.js certifies with checkReading and reduces with reduceReading. Requires sphuta.js, kala-dvara.js, ss-udaya.js, ss-chaya.js, ss-grahana.js — the sovereign files only. Browser: window.Yantra (needs Sphuta, KalaDvara, SSUdaya, SSChaya, SSGrahana); node: module.exports.
आवश्यक · requires

What it loads

required by
निर्यात · exports

What it exports

पाठ · the verses it cites

SS verses named in the header

none in the registry

नलिका · channels

The channels it runs in

not on a channel
कार्य · the functions

Every function, what it calls, who calls it

68 top-level functions read from the source; the doc line is the comment above each; calls and callers are resolved across the registry’s modules by name. Line numbers are the file’s at engine 3f94072.

root2(x)lines 80–80
calls nothing in the registry
isObj(x)lines 81–81
calls nothing in the registry
fin(x)lines 82–82
calls nothing in the registry
jya(deg)lines 86–86exported

Signed R-sine of an arc in degrees (sphuta.js: Mādhava's, or the table with withSine("table")).

koti(deg)lines 88–88exported

The koṭijyā: the R-sine of the complement (the R-cosine).

arcOfLegs(y, x)lines 91–95exported

The arc (degrees, 0…90) whose sine is to its cosine as the leg y to the leg x (both ≥ 0): bhuja, koṭi, karṇa = √(y² + x²); the smaller leg × R ÷ karṇa is taken to its arc (2.33), and the other arc is 90° less it.

angleOf(y, x)lines 98–102exported

The angle (degrees, 0 ≤ … < 360) of a direction from its component along the zero direction (x) and along the 90° direction (y), placed by quadrant as 2.29-2.30 place a bhuja.

signedArc(y, x)lines 104–104exported

A signed arc in (−90°, 90°): the sign of y, the arc of the legs.

arcLength(r, arcmin)lines 106–106exported

Length along a circle of radius r of an arc of `arcmin` minutes: r × arcmin ÷ ρ.

arcminOfLength(r, len)lines 108–108exported

The minutes of arc that a length along a circle of radius r spans.

chord(r, deg)lines 110–110exported

The chord of an arc of `deg` degrees on radius r: 2r × jyā(deg ÷ 2) ÷ R (signed with the arc).

tanLength(r, deg)lines 112–112exported

r × tan(deg) by the sine and its koṭi.

calls jya, koti
called by samrat
kapalaOfAsus(asus, round)lines 116–121exported

Asus → { ghati, vinadi, prana } (prana fractional unless `round`).

calls nothing in the registry
arcOfDegrees(deg, round)lines 123–128exported

Degrees → { amsha, kala, vikala } of its magnitude (vikala fractional unless `round`).

calls nothing in the registry
degreesOfArc(a, where, max, open)lines 131–139exported

{ amsha, kala, vikala } → degrees, refused outside 0 ≤ … ≤ max (or < max when `open`).

calls isObj, fin
asusOfNata(k, where)lines 141–145

A nata { ghati, vinadi, prana } → asus (at most half a turn).

calls nothing in the registry
placeOf(site)lines 150–163exported

The owner's place: { latitude (degrees, northern) | palabha (aṅgula), deshantara (degrees east of Ujjayinī's meridian) }. The palabhā by 3.16b-3.17a from a latitude; akṣajyā and lambajyā from the palabhā over the equinoctial hypotenuse (3.13).

ayanamshaAt(t, o)lines 167–167

── the sky: the text's Sun and stars, and the frame ───────────────────────────────────────────────

calls nothing in the registry
sunAt(t, site, opts)lines 171–175exported

The text's Sun at t: its sāyana place (sphuta.js, 3.9-3.10), the sine of its declination (2.28) and its day-radius (2.60), its right ascension (3.42 at its point), the meridian's asus (the turn, ss-grahana.js) and its hour angle, nata = meridian − ascension (asus, west +). opts.ayanamsha: degrees in place of the text's.

checkStar(star)lines 176–178
calls isObj, fin
called by starAt
starAt(t, star, site, opts)lines 181–187exported

A junction star at t: its polar longitude (dhruvaka + ayanāṃśa), its declination = the polar longitude's with the vikṣepa (2.58, 2.63), its right ascension (3.42 at its dhruvaka) and its hour angle — as vedha-lekha.js predicts a transit.

horizonOf(kj, dj, natAsus, site)lines 194–202exported

A body's direction in the horizon frame, in R-units, from the sine of its declination kj, its day-radius dj and its nata (asus, west +). up = the śaṅku of 3.34b-3.36 = (kṣitijyā + dyujyā × koṭijyā(nata) ÷ R) × lambajyā ÷ R (the cheda written out; kṣitijyā 2.61); north = agrājyā − śaṅkutala = kj × R ÷ lambajyā − śaṅku × palabhā ÷ 12 (3.27b, 3.23b-3.24 in R-units); east = −dyujyā × jyā(nata) ÷ R, th

The horizon direction (R-units) of an altitude and an azimuth (degrees from the north point through the east).

calls jya, koti
called by nothing in the registry
altAzOf(h)lines 209–212exported

Altitude (−90…90) and azimuth (0…360 from north through east) of a horizon direction.

equatorialOfHorizon(h, site)lines 215–221exported

The rotation back by the latitude: R sin δ = (north × lambajyā + up × akṣajyā) ÷ R; R cos δ cos H = (up × lambajyā − north × akṣajyā) ÷ R; R cos δ sin H = −east. Returns the declination (degrees) and the nata (asus, west +).

quantitiesOf(st, site)lines 224–229exported

Everything an instrument can read of a body in state `st`: the nata, the declination and its gola, the altitude, the azimuth, the zenith distance and the side of the zenith (disha: the horizon the altitude is read from).

The instant on civil day N at which the body's nata is `natAsus`: for the Sun, near the text's local noon of day N (N + ½ − deśāntara ÷ 360); for a star, in the turn that begins six hours after local midnight.

The instant, in the turn that begins six hours after local midnight of day N, at which the meridian's asus are `asus`.

nataOfShanku(up, kj, dj, site)lines 254–260exported

3.37-3.39 for any body: the nata (asus, 0…10,800) at which a body of declination-sine kj and day-radius dj stands at the śaṅku `up` (the R-sine of its altitude): cheda = śaṅku × R ÷ lambajyā; unnatajyā = cheda × R ÷ dyujyā; less the carajyā = kṣitijyā × R ÷ dyujyā (2.61) it is the koṭijyā of the nata (R − (antyā − unnatajyā)). null when never reached.

The instant on day N at which the body stands at altitude `unnataDeg` on the given side of the meridian ("purva", east, before its transit; "pashcima", west). null when it does not reach that altitude.

The instant on day N at which the body stands at azimuth `digamshaDeg`: east of the meridian (0° < A < 180°) before its transit, west after; the nata found by halving on that side, the body's place renewed at each instant found.

entry(o)lines 305–305
calls nothing in the registry
called by nothing in the registry
positive(x, what)lines 360–360

── what every instrument shares ───────────────────────────────────────────────────────────────────

sideOf(natAsus)lines 361–361
calls nothing in the registry
golaSign(g)lines 362–362
calls nothing in the registry
sideSign(s)lines 363–363
calls nothing in the registry
dishaSign(d)lines 364–364
calls nothing in the registry

An instrument: its static parts, and predict(t, opts) → { quantities, position, reading } at t (opts.star for a star).

signEndDeclinations()lines 382–382

The declinations of the sign ends (13.6-13.7): Meṣa…Mithuna's, the same reversed for Karka…Kanyā, southern for Tulā on.

calls nothing in the registry
shanku(opts)lines 386–441exported

शङ्कु — the gnomon of chapter 3 (13.20 names it), of height `height` (aṅgula; 12 by 3.2), wrapped from ss-chaya.js.

called by nothing in the registry
meta(m)lines 442–442
calls nothing in the registry

The bowl's sinking, exactly (owner, 2026-10-27: "whatever is perfect for the model"). A thin bowl floats while the water it puts aside equals its own load and the water inside; the water comes in by the hole at the speed of a fall through the head h — the outer depth less the inner — √(2gh). shape "hemisphere" (depths in its radius; filled part (3z² − z³)/2 of the whole) or "cylinder" (depths in i

calls nothing in the registry
called by nothing in the registry
kapalaka()lines 477–524exported
called by nothing in the registry
gola(opts)lines 531–565exported

गोलयन्त्र — the sphere of 13.3-13.17, set to the latitude. Rings of `circumference` aṅgulas (180 by 13.5: the degrees of a revolution as aṅgulas, halved), so half an aṅgula to a degree along every great ring; the diurnal circles at their declinations, halved, north and south (13.6-13.7), each of its own radius (svāhorātrārdhakarṇa, 13.5); the ecliptic (krānti, 13.12) at the greatest declination; t

called by nothing in the registry
vec(e, n, u)lines 569–569

Points of the instrument relative to a centre, as { east, north, up } in the owner's unit.

calls nothing in the registry
called by samrat, nadivalaya
samrat(opts)lines 578–616exported

सम्राट् — the gnomon along the axis. Sizes: one of hypotenuse | height | base; radius of the quadrants; centre = the quadrants' centre's distance along the hypotenuse from its lower (south) end (default: the middle). [theorem] The hypotenuse is parallel to the axis, so it rises northward at the latitude; tan φ = palabhā ÷ 12, so the gnomon is the equinoctial shadow triangle — base : height : hypot

nadivalaya(opts)lines 622–650exported

नाडीवलय — a dial of radius r in the equator's plane, a pin of length `pin` on each face at the centre, along the axis. [theorem] The north face (uttara) looks at the north pole and is lit while the declination is north, the south face (dakṣiṇa) while it is south. The pin's shadow on the lit face lies at the nata from the dial's lowest radius, toward the east edge after noon; its length is pin × ko

called by nothing in the registry
hemisphere(key, opts)lines 656–685

The hemispherical bowl (Jaya Prakāśa; Kapāla): radius r, rim level, cross-wires meeting over its centre. [theorem] The wires' crossing throws its shadow at the point of the bowl opposite the body: depth r × jyā(altitude) ÷ R below the rim, r × koṭijyā(altitude) ÷ R from the axis, bearing azimuth + 180°; the bowl is the sky inverted, its lowest point the zenith's image, the pole's image south of th

jayaPrakasha(opts)lines 687–687exported

जयप्रकाश — the hemispherical bowl under cross-wires.

called by nothing in the registry
kapalaYantra(opts)lines 689–689exported

कपाल यन्त्र — the same hemisphere [reading].

called by nothing in the registry
ramaYantra(opts)lines 695–724exported

राम यन्त्र — a pillar of height `pillar` at the centre of an open cylinder of radius `radius`, its wall of height `wall` (default: the pillar's). [theorem] The pillar-top's shadow lies at bearing azimuth + 180°, on the floor at pillar × koṭijyā(a) ÷ jyā(a) from the foot while that is within the radius, else on the wall at height pillar − radius × jyā(a) ÷ koṭijyā(a); the change is at the altitude

called by nothing in the registry
digamshaYantra(opts)lines 728–736exported

दिगंश यन्त्र — a pillar at the centre of a circular wall of radius `radius`, its top graduated in azimuth from the north point through the east. [theorem] A body is sighted at its azimuth's mark; the pillar's shadow falls at azimuth + 180°.

called by nothing in the registry
shashthamshaYantra(opts)lines 743–759exported

षष्ठांश यन्त्र — a sixty-degree arc of radius `radius` in the meridian under a pinhole at its centre. [theorem] At noon the Sun's image falls on the arc at its zenith distance from the point under the pinhole, on the side away from the Sun; at noon the zenith distance is φ − δ, so the arc can be labelled in declination as well. The arc is centred on the equinox's noon (zenith distance φ) unless `c

dakshinottaraBhitti(opts)lines 764–775exported

दक्षिणोत्तर भित्ति — a wall in the meridian; a pin perpendicular to it at the centre of two quadrants of radius `radius` below it, one each side. [theorem] At transit the Sun's shadow of the pin falls on the quadrant on the side away from it, the altitude below the pin's horizontal; a star is sighted from the same mark through the pin.

called by nothing in the registry
rashivalaya(opts)lines 783–814exported

राशिवलय — twelve gnomons with quadrants of radius `radius`. [theorem] The k-th is set along the ecliptic's pole at the moment sign k's first point (sāyana 30k°) is on the meridian — when the meridian's asus equal that point's right ascension (3.42 at the point); then its quadrants lie in the ecliptic's plane and the shadow of its edge falls at the Sun's distance in longitude from the ecliptic's hi

unnatamshaYantra(opts)lines 818–827exported

उन्नतांश यन्त्र — a ring of radius `radius` in a vertical plane that turns on a vertical axis, a sight pivoted at its centre. [theorem] The altitude is read from the ring's level diameter: arc r × a, chord 2r jyā(a ÷ 2) ÷ R.

called by nothing in the registry
instrument(key, opts)lines 832–836exported

An instrument by its catalogue key, with the owner's site and sizes.

calls nothing in the registry
called by nothing in the registry
checkReading(key, reading, body)lines 859–879exported

Checks a "yantra" record's instrument, body and reading (its own graduation's fields only). Throws on the first fault.

quantitiesOfReading(key, reading)lines 881–895exported

A reading → the quantities it states (nata asus west +, declination, altitude, azimuth, signed zenith distance, longitude).

readingOfQuantities(key, q, extra)lines 897–910exported

The reading of a set of predicted quantities as instrument `key` shows it (the labels a "yantra" record carries).

called by nothing in the registry
record(key, m)lines 913–920exported

A ledger record of kind "yantra" (vedha-lekha.js): { id, day, body ("surya" or a star's name), reading, kapala?, calibration?, observer?, note?, synthetic?, generator?, ganita? }. The reading is checked first.

reduceReading(r, site, ctx)lines 927–957exported

Reduces one "yantra" record: what it measured [measured], the instant it is compared at, the text's quantities there, and the antara (observed − the text). ctx: { N (its civil day), t (the instant by the bowl, when it carries a kapala), star (the catalogue entry, when the body is a star) }. The instant, in order: the bowl's count; the meridian for the wall and the arc (and a ring read with a disha