“শ্লোকে যা লেখা আছে, সেটাই সরাসরি code”—এই ধারণা আকর্ষণীয়, কিন্তু ঐতিহাসিক গাণিতিক গ্রন্থের ক্ষেত্রে নিরাপদ নয়। শ্লোক স্মরণযোগ্য সংক্ষিপ্ত ভাষায় একটি নিয়ম ধরে রাখে; executable algorithm বানাতে source context, technical vocabulary, implied operands, units, direction, epoch, remainder এবং rounding policy পুনর্গঠন করতে হয়।
সূর্যসিদ্ধান্তের শ্লোক কেন Pseudocode নয়?
শ্লোকের উদ্দেশ্য ছিল সংক্ষিপ্ততা, ছন্দ ও স্মরণযোগ্যতা। ফলে আধুনিক programmer যে বিষয়গুলো function signature-এ আশা করেন, সেগুলো প্রায়ই implicit:
- input quantity আগের দুই বা তিন শ্লোকে সংজ্ঞায়িত;
- একক পুনরায় বলা হয় না;
- “multiply” বা “divide”-এর subject context থেকে ধরতে হয়;
- পূর্ণ revolution বাদ দিয়ে remainder নেওয়া implicit হতে পারে;
- direct ও retrograde motion-এর sign আলাদা শ্লোকে আসে;
- sexagesimal output—rāśi, degree, kalā, vikalā—modern decimal degree নয়;
- verse data, computational rule এবং cosmological explanation পাশাপাশি থাকে;
- commentator বা translator কোনো missing computational bridge ব্যাখ্যা করতে পারেন।
অতএব শ্লোক থেকে code বানানোর সময় আমাদের কাজ “অনুবাদ” মাত্র নয়; একটি documented mathematical reconstruction। Reconstruction মানে ইচ্ছেমতো নতুন নিয়ম যোগ করা নয়—কোন অংশ পাঠে, কোন অংশ commentary-তে, কোন অংশ software engineering-এ এসেছে তা আলাদা রাখা।
এই Project-এর ছয়টি Source Layer
| Layer | উদাহরণ | ভূমিকা | Label |
|---|---|---|---|
| S1: মূল/সম্পাদিত পাঠ | সংস্কৃত শ্লোক, chapter–verse | প্রাথমিক textual evidence | VERSE |
| S2: অনুবাদ | Burgess, Bāpū Deva Śāstrī | Technical meaning-এর ভাষান্তর | TRANSLATION |
| S3: Commentary | Burgess notes, traditional commentary | Ellipsis, constants, historical interpretation | COMMENTARY |
| S4: Reference implementation | Yano–Fushimi pancanga3.14 | একটি executable interpretation | REFERENCE_CODE |
| S5: Project implementation | SuryaSiddhantaEngine.cs | .NET port, types, precision, API | PROJECT_CODE |
| S6: Empirical fit | 1947+ Sankranti star-correction table | Printed Panjika alignment | CALIBRATION |
S4 code-এ কোনো constant থাকলেই সেটি S1 শ্লোকে আছে—এ দাবি করা যাবে না। আবার S6 correction ভালো modern match দিলেও সেটি ancient text-এর “lost formula” হয়ে যায় না। Publication-এ layer label রাখলে পাঠক মূল সূত্র ও প্রকল্পের adjustment আলাদা করতে পারেন।
শ্লোক থেকে Code: দশ ধাপের Workflow
- Edition, chapter, verse এবং variant নির্ধারণ;
- শ্লোকটি data, operation, definition না description—শ্রেণিবদ্ধ করা;
- সংখ্যা ও technical terms উদ্ধার;
- একক ও sexagesimal scale স্বাভাবিক করা;
- variables, inputs, outputs এবং valid domain লেখা;
- শব্দ-নিয়মকে algebraic equation-এ রূপান্তর;
- modulo, direction, interpolation ও rounding policy নির্ধারণ;
- exact/intermediate-preserving code লেখা;
- প্রতিটি intermediate value trace করা;
- textual, arithmetic ও regression validation করা।
ধাপ ১: Edition ও Verse Identity স্থির করা
একটি citation শুধু “Surya Siddhanta” হলে যথেষ্ট নয়। অন্তত লিখুন:
- chapter ও verse range;
- ব্যবহৃত Sanskrit edition/e-text;
- translation edition এবং publication year;
- variant reading থাকলে নির্বাচিত পাঠ;
- verse numbering কোন edition অনুসরণ করে;
- commentary-র বক্তব্য original verse থেকে আলাদা কি না।
Burgess-এর public-domain অনুবাদে Chapter I-এর বিষয় “Mean Motions of the Planets”; Chapter II “True Places of the Planets।” এই chapter separation-ই একটি গুরুত্বপূর্ণ design boundary: Chapter I থেকে পাওয়া mean place-কে সরাসরি final true longitude বলা যাবে না।
একটি Formula record-এর ন্যূনতম citation
Formula ID: SS-I-53-MEAN-PLACE
Text: Sūrya Siddhānta I.53
Sanskrit edition: ...
Translation: Burgess, 1860, Chapter I, verse 53
Commentary used: yes/no; exact note
Reference code: pancanga3.14 function/line
Project code: SuryaSiddhantaEngine.MeanLongitude()
Rule version: 1
ধাপ ২: শ্লোকটি কী ধরনের?
| Type | কাজ | Chapter I example |
|---|---|---|
| Definition | একক বা ধারণা সংজ্ঞায়িত | I.28: vikalā → kalā → degree → rāśi → revolution |
| Constant/data | Revolution বা cycle count দেয় | I.29–34, I.37–39 |
| Algorithm | Operands ও operation দেয় | I.53: days × revolutions ÷ cycle-days |
| Direction rule | Sign/orientation নির্ধারণ | I.54: node-এর reverse motion |
| Time adjustment | Fractional day correction | I.67: nāḍī-ভিত্তিক adjustment |
| Description | Conceptual/cosmological context | I.25, I.27-এর motion description |
একটি algorithm verse একা যথেষ্ট নাও হতে পারে। I.53 বুঝতে I.28-এর units, I.29–34-এর revolutions এবং I.37-এর day count দরকার। তাই “source range” অনেক সময় single verse-এর চেয়ে বড়।
ধাপ ৩: শব্দে লুকানো সংখ্যা উদ্ধার
সংস্কৃত astronomical verse-এ সংখ্যা সরাসরি decimal digits-এ না এসে object-word বা bhūta-saṃkhyā পদ্ধতিতে প্রকাশিত হতে পারে। যেমন একটি পরিচিত বস্তু তার conventional count নির্দেশ করে। Compound-এর reading order, manuscript variant এবং editor-এর supplied numeral যাচাই না করে constant code করবেন না।
Chapter I.29–34-এ গ্রহের revolutions এবং I.37-এ cycle-day count verse-এর মধ্যে encoded। আধুনিক edition বা commentary প্রায়ই পাশে decoded integer দেয়। নিরাপদ process:
- compound শব্দ আলাদা করা;
- প্রতিটি number-word-এর conventional digit লেখা;
- reading order যাচাই;
- edition-এর printed number/table-এর সঙ্গে মিল;
- অন্য independent translation-এ cross-check;
- code constant-এর পাশে verse citation রাখা।
ধাপ ৪: একক স্বাভাবিকীকরণ
Chapter I.28 sexagesimal angular chain দেয়:
৬০ vikalā = ১ kalā
৬০ kalā = ১ bhāga বা degree
৩০ degree = ১ rāśi
১২ rāśi = ১ bhagaṇa বা revolution
| Traditional unit | Modern representation | Internal recommendation |
|---|---|---|
| Bhagaṇa | ১ turn = ৩৬০° | Integer/fractional turns or normalized degree |
| Rāśi | ৩০° | Index 0–11; display label separate |
| Bhāga | ১° | Decimal/rational degree |
| Kalā | ১ arcminute | 1/60 degree |
| Vikalā | ১ arcsecond | 1/3600 degree |
| Nāḍī/Ghaṭī | দিনের 1/60 | Duration; ২৪ modern minutes |
| Vināḍī/Pala | Nāḍī-এর 1/60 | ২৪ modern seconds |
Code-এ unit suffix দিন: longitudeDegrees, elapsedDays, timeNadis। শুধু x বা motion লিখলে degree/day, arcminute/day এবং revolution/cycle মিশে যায়।
ধাপ ৫: Variables, Domain ও Reference লিখুন
Mean-place rule-এর জন্য:
- D: নির্বাচিত epoch থেকে elapsed terrestrial/civil days;
- R: একই cycle-এ target-এর revolutions;
- N: সেই cycle-এর terrestrial days;
- Q: elapsed whole revolutions;
- r: division remainder;
- λ̄: normalized mean longitude।
R এবং N একই reference cycle-এর হতে হবে। Mahāyuga revolution count-এর সঙ্গে Kalpa day count সরাসরি মেশানো যাবে না—যদিও consistent scaling করলে ratio একই হতে পারে। Epoch definition-ও formula-র অংশ; D ভুল হলে arithmetic নিখুঁত হলেও longitude ভুল।
ধাপ ৬: বর্ণনামূলক Rule থেকে Algebra
Chapter I.53-এর operational অর্থ: elapsed days-কে target-এর revolution count দিয়ে গুণ করে cycle-day count দিয়ে ভাগ করলে elapsed mean revolutions এবং বর্তমান revolution-এর অংশ পাওয়া যায়।
T = D × R / N
Q = floor(T)
Fraction = T − Q
λ̄ = 360° × Fraction
Integer arithmetic-এ আরও স্পষ্ট:
P = D × R
Q = P div N
r = P mod N
λ̄ = r × 360° / N
Verse I.54 retrograde node-এর জন্য direction বদলায়। Direct result x হলে normalized reverse result:
λ̄node = Normalize(360° − x)
I.67 fractional day-এর জন্য daily motion-কে elapsed nāḍī/60 দিয়ে scale করে appropriate sign-এ midnight place-এর সঙ্গে যোগ/বিয়োগ করে। অর্থাৎ “date-এর planet” বললেই reference midnight, sunrise না noon—তা ঘোষণা করা জরুরি।
ধাপ ৭: Algebra থেকে Numerical Algorithm
Mathematical equation এক হলেও software-এ কয়েকটি policy দরকার:
- Overflow: D × R 64-bit ছাড়াতে পারে—
BigIntegerব্যবহার; - Euclidean remainder: negative historical D-এর remainder ০…N−১ করা;
- Precision: product/division-এর আগে floating-point conversion নয়;
- Normalization: longitude সর্বদা ০° ≤ λ < ৩৬০°;
- Rounding: classification full precision-এ; rounding শুধু display-এ;
- Epoch: D integer না fractional তা স্পষ্ট;
- Direction: retrograde constant sign/transform একবারই প্রয়োগ;
- Trace: product, quotient, remainder ও final degree সংরক্ষণ।
Worked Example: I.53 থেকে Mean Sun
এটি method demonstration—কোনো নির্দিষ্ট historical date-এর published Sun position নয়। ধরা যাক epoch-এর ১,০০০ terrestrial day পরে mean Sun চাই। Chapter I-এর traditional cycle values:
- D = ১,০০০ days;
- R = ৪,৩২০,০০০ solar revolutions per Mahāyuga;
- N = ১,৫৭৭,৯১৭,৮২৮ terrestrial days per Mahāyuga।
প্রথমে integer product:
P = ১,০০০ × ৪,৩২০,০০০ = ৪,৩২০,০০০,০০০
তারপর division:
Q = ২ whole revolutions
r = ১,১৬৪,১৬৪,৩৪৪
বর্তমান revolution-এর angle:
λ̄ = ১,১৬৪,১৬৪,৩৪৪ × ৩৬০° ÷ ১,৫৭৭,৯১৭,৮২৮
λ̄ ≈ ২৬৫° ৩৬′ ০৯.৫৬″
এটি Dhanu ২৫° ৩৬′ ০৯.৫৬″ mean longitude। কিন্তু এখনো:
- real calendar epoch/JD বসানো হয়নি;
- fractional time-of-day adjustment করা হয়নি;
- deśāntara correction নেই;
- manda correction নেই;
- Traditional Fit/Bīja নেই;
- তাই এটি True Sun বা Saṅkrānti time নয়।
C#-এ Exact-first Mean-place Function
using System;
using System.Numerics;
public sealed class MeanPlaceTrace
{
public BigInteger ElapsedDays { get; set; }
public BigInteger RevolutionsPerCycle { get; set; }
public BigInteger DaysPerCycle { get; set; }
public BigInteger Product { get; set; }
public BigInteger WholeRevolutions { get; set; }
public BigInteger Remainder { get; set; }
public double LongitudeDegrees { get; set; }
public string FormulaId { get; set; }
}
public static MeanPlaceTrace MeanPlace(
BigInteger elapsedDays,
BigInteger revolutionsPerCycle,
BigInteger daysPerCycle)
{
if (daysPerCycle <= BigInteger.Zero)
throw new ArgumentOutOfRangeException("daysPerCycle");
BigInteger product = elapsedDays * revolutionsPerCycle;
// Euclidean remainder: always 0 <= remainder < daysPerCycle.
BigInteger remainder = product % daysPerCycle;
if (remainder.Sign < 0)
remainder += daysPerCycle;
BigInteger wholeRevolutions =
(product - remainder) / daysPerCycle;
double longitude =
(double)remainder * 360.0 / (double)daysPerCycle;
return new MeanPlaceTrace
{
ElapsedDays = elapsedDays,
RevolutionsPerCycle = revolutionsPerCycle,
DaysPerCycle = daysPerCycle,
Product = product,
WholeRevolutions = wholeRevolutions,
Remainder = remainder,
LongitudeDegrees = Normalize(longitude),
FormulaId = "SS-I-53-MEAN-PLACE"
};
}
static double Normalize(double value)
{
value %= 360.0;
if (value < 0.0) value += 360.0;
return value;
}
Remainder cycle-days-এর চেয়ে ছোট, তাই final conversion সাধারণ traditional constants-এ double-এ নিরাপদ range-এ থাকবে। তবু research-grade trace-এ rational form r/N রেখে দিলে অন্য language বা high-precision implementation-এর সঙ্গে exact comparison সহজ হয়।
Rāśi–degree–kalā–vikalā conversion
public sealed class TraditionalAngle
{
public int Rasi { get; set; }
public int Degree { get; set; }
public int Kala { get; set; }
public double Vikala { get; set; }
}
public static TraditionalAngle SplitAngle(double longitude)
{
double x = Normalize(longitude);
int rasi = (int)Math.Floor(x / 30.0);
double inRasi = x - rasi * 30.0;
int degree = (int)Math.Floor(inRasi);
double minutes = (inRasi - degree) * 60.0;
int kala = (int)Math.Floor(minutes);
double vikala = (minutes - kala) * 60.0;
return new TraditionalAngle
{
Rasi = rasi,
Degree = degree,
Kala = kala,
Vikala = vikala
};
}
Carry handling display formatter-এ করুন: vikalā rounding-এ 60 হলে kalā বাড়বে; kalā 60 হলে degree; degree 30 হলে rāśi। Classification-এর source value কখনো rounded structure থেকে পুনর্গঠন করবেন না।
Formula Provenance-কে Code-এর অংশ করুন
public sealed class FormulaProvenance
{
public string FormulaId { get; set; }
public string TextName { get; set; }
public string ChapterVerse { get; set; }
public string SanskritEdition { get; set; }
public string TranslationEdition { get; set; }
public string InterpretationNote { get; set; }
public string ReferenceImplementation { get; set; }
public string ProjectImplementation { get; set; }
public string RuleVersion { get; set; }
public bool UsesEmpiricalCalibration { get; set; }
}
উদাহরণ:
FormulaId: SS-I-53-MEAN-PLACE
ChapterVerse: I.53
Inputs from: I.29–34 and I.37
Units from: I.28
Direction supplement: I.54
Partial-day supplement: I.67
Reference implementation: pancanga3.14
Project implementation: SuryaSiddhantaEngine.MeanPlace
Empirical calibration: false
ModernFit Saṅkrānti function-এর provenance আলাদা হবে এবং UsesEmpiricalCalibration = true। তাতে ancient formula ও printed-Panjika fit audit report-এ গুলিয়ে যাবে না।
Validation Ladder: “ফল মিলেছে” যথেষ্ট নয়
| Level | প্রশ্ন | পরীক্ষা |
|---|---|---|
| V1 Textual | সব term ও operation accounted? | Verse-by-verse ledger |
| V2 Dimensional | Units cancel/convert সঠিক? | days × rev/cycle-days → revolutions |
| V3 Arithmetic | Integer quotient/remainder সঠিক? | Hand example ও exact rational |
| V4 Boundary | 0/360, negative D, exact division? | Unit tests |
| V5 Reference-code | Perl implementation-এর intermediate মিলছে? | Same constants/epoch comparison |
| V6 Independent implementation | অন্য language একই result দেয়? | C#, Perl, spreadsheet |
| V7 Published table | Historical worked values মিলছে? | Burgess/commentary example |
| V8 Observation/modern ephemeris | Model discrepancy কত? | Comparison, silent replacement নয় |
Modern Swiss value-এর সঙ্গে অমিল হলেই verse-to-code conversion ভুল—এ সিদ্ধান্ত দেওয়া যায় না। আগে V1–V7 পরীক্ষা করুন। V8 traditional model-এর accuracy ও accumulated drift মাপে; textual fidelity আলাদা প্রশ্ন।
Essential unit tests
- D = 0 → longitude 0° অথবা declared epoch offset;
- D = N → পূর্ণ cycle শেষে 0°;
- D = N/2 এবং R compatible হলে expected half-cycle;
- negative D → normalized 0°…360°;
- direct ও retrograde node complementary;
- exact 30° boundary-তে rāśi indexing;
- vikalā rounding carry;
- BigInteger path বনাম rational/spreadsheet result;
- same formula C# ও
pancanga3.14-এ intermediate comparison।
True Planet Position-এ যাওয়ার আগে কী যোগ হবে?
Mean place একটি uniform circular model-এর অবস্থান। Chapter II-এর true-place pipeline-এ গ্রহভেদে আরও quantity ও operation যুক্ত হয়। পরবর্তী প্রবন্ধগুলোতে আলাদাভাবে বিশ্লেষণ করা হবে:
- Mean planet ও relevant mean Sun/śīghrocca;
- Mandocca বা slow apsis;
- Manda anomaly/kendra;
- Manda epicycle measure;
- Bhujā, koṭi ও jyā interpolation;
- প্রথম manda correction;
- Śīghra anomaly এবং śīghra correction;
- planet class অনুযায়ী repeated/half corrections;
- final normalized true longitude;
- deśāntara, Bīja এবং project calibration-এর পৃথক স্তর।
Sun ও Moon, superior planets—Mars/Jupiter/Saturn—এবং Mercury/Venus একই dependency chain ব্যবহার করে না। তাই একটি generic “truePlanet(mean)” function দিয়ে শুরু না করে প্রথমে dependency graph ও formula ledger বানানো হবে।
সাধারণ ভুল
Translation-এর explanatory word-কে original শ্লোক ভাবা
Translator readability-এর জন্য operand বা context যোগ করতে পারেন। Sanskrit term, translation এবং commentary তিন column-এ রাখুন।
Decimal-এ খুব তাড়াতাড়ি যাওয়া
Large cycle counts প্রথমে exact integer ratio হিসেবে রাখুন। আগে floating-point করলে বহু যুগের multiplication-এ remainder বদলাতে পারে।
Remainder-এর বদলে total turns × 360 নেওয়া
Whole revolutions বাদ না দিলে huge angle তৈরি হয় এবং precision নষ্ট হয়। আগে Euclidean remainder, পরে degree conversion।
Negative historical date-এ language-এর % blindly ব্যবহার
C# remainder negative হতে পারে। Explicit Euclidean normalization করুন।
Mean result-কে true position বলা
I.53 mean place দেয়; Chapter II correction ছাড়া true planet নয়।
Reference implementation-কে infallible text ভাবা
pancanga3.14 অমূল্য computational reference, কিন্তু সেটিও একটি implementation। Text, comments, constants ও code path independently audit করুন।
ModernFit correction-কে ancient Bīja ঘোষণা করা
আপনার 1947+ table একটি documented empirical calibration। Ancient textual Bīja, later traditional correction এবং project fit আলাদা provenance-এ থাকবে।
Publication ও Research Checklist
- Chapter/verse এবং edition লেখা?
- Original text, translation ও commentary আলাদা?
- Encoded number independently verified?
- Input/output units স্পষ্ট?
- Epoch ও reference meridian লেখা?
- Direct/retrograde sign convention লেখা?
- Modulo ও negative-date policy স্পষ্ট?
- Integer arithmetic যতক্ষণ সম্ভব সংরক্ষিত?
- Rounding শুধু display-এ?
- Intermediate product/quotient/remainder export করা যায়?
- Reference Perl ও C# result একই constants-এ তুলনা করা?
- Mean ও true labels পৃথক?
- Textual constant ও empirical correction পৃথক?
- Formula version batch HTML/XML/API-তে সংরক্ষিত?
উপসংহার
সূর্যসিদ্ধান্তের শ্লোককে software-এ রূপান্তর মানে প্রাচীন ভাষাকে আধুনিক syntax-এ প্রতিস্থাপন নয়। এটি source criticism, technical translation, unit analysis, algebra, numerical computing এবং reproducibility-এর সম্মিলিত কাজ। একটি trustworthy formula-র সঙ্গে তার verse, edition, interpretation, units, epoch, direction, modulo ও rounding policy থাকতে হবে।
Chapter I.53 দেখায় এই পদ্ধতি কতটা পরিষ্কার হতে পারে: elapsed days × revolutions ÷ cycle-days থেকে quotient ও remainder; remainder থেকে normalized mean longitude। কিন্তু একই সঙ্গে এটি শেখায়—একটি সুন্দর mean longitude এখনো True Planet নয়। পরবর্তী ধাপে যুগ, মহাযুগ, ভগণ, অহর্গণ ও mean motion-এর ভিত্তি সম্পূর্ণভাবে নির্মাণ করে তারপর Chapter II-এর manda–śīghra correction pipeline-এ প্রবেশ করা হবে।
প্রাথমিক পাঠ ও তথ্যসূত্র
- Ebenezer Burgess, Translation of the Sûrya-Siddhânta: A Text-book of Hindu Astronomy, Journal of the American Oriental Society, 1858/1860; public-domain scan, translation, notes ও appendix।
- Sūrya Siddhānta, Chapter I—Sanskrit verse ledger; I.28 units, I.29–40 constants, I.53–54 mean-place/direction এবং I.67 time adjustment; source notes identify Michio Yano's GRETIL e-text and Burgess numbering।
- Bāpū Deva Śāstrī, English Translation of the Sūrya Siddhānta, 1861; independent public-domain translation witness।
- M. Yano and M. Fushimi, Pancanga version 3.14; Perl reference implementation description।
pancanga3.14source script; executable interpretation used as one comparison layer in this project।
পাঠকের কণ্ঠ
প্রশ্ন ও আলোচনা 0
যেকোনো মন্তব্য বা উত্তরে আবার উত্তর দিন। প্রতিটি উত্তর তার মূল আলোচনার সঙ্গে থাকবে।
আলোচনাটি আপনিই শুরু করুন
এই প্রবন্ধ নিয়ে আপনার প্রশ্ন বা মতামত লিখুন।
আলোচনায় যোগ দিন
আপনার প্রশ্ন বা মতামত