Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

need help in calculating vimshottari dasha

Links for php scripts

Moderators: macek, egami, gesf

need help in calculating vimshottari dasha

Postby astrosanthosh » Sat Apr 06, 2013 5:15 am

Namaste,
i am new to this group. i need some help in calculating vimshotari dasha. if anyone interestedd, i will give data how to proceed.
thanks
astrosanthosh
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Apr 06, 2013 5:09 am

Re: need help in calculating vimshottari dasha

Postby seandisanti » Fri Apr 12, 2013 7:49 pm

we can help, what's up?
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: need help in calculating vimshottari dasha

Postby astrosanthosh » Sun Apr 14, 2013 5:26 am

Thanks,
here i am giving java script page of jyotishtools.com. you can use this or you can make new one based on this.
i need this in php only dasha calculation. output shold display in php. thats all i need. thanks again for your help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>

<body>
<form NAME="LunarCalc">
<div align="left"><table border="1" width="87%" height="157">
<tr>
<td width="100%" height="28" colspan="2">Month:&nbsp; <input type="text" name="Month"
size="2" value="1" tabindex="1">&nbsp;&nbsp; Day: <input type="text" name="Day" size="2"
value="1" tabindex="2">&nbsp;&nbsp;&nbsp;&nbsp; Year: <input type="text" name="Year"
size="5" value="1999" tabindex="3"> </td>
</tr>
<tr>
<td width="100%" height="29" colspan="2">Time:&nbsp; <input type="text" name="Hour"
size="2" value="0" tabindex="4"><input type="text" name="Min" size="2" value="00"
maxlength="2" tabindex="5"> Zone: <input type="text" name="ZHour" size="2" value="0"
tabindex="6"> <input type="text" name="ZMin" size="2" value="0" maxlength="2" tabindex="7">
&nbsp;<input type="checkbox" name="DST" value="DST" tabindex="8"> DST</td>
</tr>
<tr>
<td width="52%" height="33">Longitude: <input type="text" name="LonDeg" size="3" value="0"
maxlength="3" tabindex="9">:<input type="text" name="LonMin" size="2" value="0"
tabindex="10"> <input type="checkbox" name="East" value="East" tabindex="11">East</td>
<td width="48%" height="33">Latitude: <input type="text" name="LatDeg" size="2" value="0"
tabindex="12">:<input type="text" name="LatMin" size="2" value="0" tabindex="13"> <input
type="checkbox" name="South" value="South" tabindex="14">South</td>
</tr>
<tr>
<td width="100%" height="43" colspan="2"><div align="center"><center><p><input
type="button" value="Calculate" name="Calculate" onClick="calculate()"></td>
</tr>
</table>
</div>
</form>

<form NAME="display" style="float: none">
<div align="left"><table border="1" width="87%" height="193">
<tr>
<td width="26%" height="125" align="center" valign="top"><div align="center"><center><p><strong><u>Non-Parallax:<big><br>
</u></strong><input type="text" name="npmoon" size="15" style="text-align: center"> </big><br>
Nakshatra<br>
<input type="text" name="nnakshatra" size="20" style="text-align: center"><br>
Dasha:<big><br>
</big><input type="text" name="npdasha" size="15" style="text-align: center"><br>
Next Dasha:<br>
<input type="text" name="npnextdasha" size="28" style="text-align: center"><br>
Current Dasha:<br>
<input type="text" name="curdasha" size="20" style="text-align: center"></td>
<td width="28%" height="125" valign="top" align="center"><div align="center"><center><p><strong><u>Parallax:<big><br>
</u></strong><input type="text" name="pmoon" size="15" style="text-align: center"> </big><br>
Nakshatra<br>
<input type="text" name="pnakshatra" size="20" style="text-align: center"><big><br>
</big>Dasha:<big><br>
</big><input type="text" name="pdasha" size="15" style="text-align: center"><br>
Next Dasha:<br>
<input type="text" name="pnextdasha" size="28" style="text-align: center"><br>
Current Dasha:<br>
<input type="text" name="curpdasha" size="20" style="text-align: center"></td>
</tr>
<tr align="center">
<td width="67%" colspan="2" height="56"><div align="center"><center><p>Days Difference: <input
type="text" name="diff" size="30" style="text-align: center"></td>
</tr>
</table>
</div>
</form>
<script LANGUAGE="JavaScript">
// globals
d2r = Math.PI/180;
r2d = 180/Math.PI;
var ra,dc; // right ascension, declination
var pln,plt; // parallax longitude and latitude
lord = "KeVeSuMoMaRaJuSaMe";
var dasha = [7,20,6,10,7,18,16,19,17];
var zn = "AriTauGemCanLeoVirLibScoSagCapAquPis"; // Zodiac
var range = [1,12,1,31,1800,2100,0,23,0,59,0,12,0,59,0,0,0,179,0,59,0,0,0,89,0,59];
var naks = [ "Aswini", "Bharani", "Krittika","Rohini", "Mrigsira","Ardra","Punarvasu",
"Pushya", "Aslesha", "Magha","P.Phalguni","U.Phalguni", "Hasta","Chitra", "Swati","Vishakha",
"Anuradha","Jyeshtha","Mula","P.Shadya", "U.Shadya","Shravana", "Dhanishtha",
"Shatbisha", "P.Phadra","U.Phadra","Revati"];





// Fill out the form with current date and time
function fillDate(){
today = new Date();
document.LunarCalc.Month.value = today.getMonth()+1;
document.LunarCalc.Day.value = today.getDate();
document.LunarCalc.Year.value = today.getFullYear();
document.LunarCalc.Hour.value = today.getHours();
document.LunarCalc.Min.value = today.getMinutes();
zmins = today.getTimezoneOffset();
with(Math){
zmins /= 60;
if(zmins < 0.0){
var eln = document.LunarCalc.East;
eln.checked = true;
}
zmins = abs(zmins);
document.LunarCalc.ZHour.value = floor(zmins);
document.LunarCalc.ZMin.value = (zmins - floor(zmins)) * 60;
}
}

function checkEntries(f){

for(i = 0; i < 13; i++){
var e = f.elements[i];
if((e.name == "DST") || (e.name == "East") || (e.name == "South"))continue;
if(isNaN(e.value) || (e.value < range[i*2] ) || ( e.value > range[i*2+1])){
msg = "Please enter value between "
+ range[i*2] + " and " + range[i*2+1]
+ " in the " + e.name + " field";
alert(msg);
return true;
}
}
return false;
}

function calculate(){

if(checkEntries(document.LunarCalc))return;

with(Math){
var mon = floor(document.LunarCalc.Month.value);
var day = floor(document.LunarCalc.Day.value);
var year= floor(document.LunarCalc.Year.value);
var hr= floor(document.LunarCalc.Hour.value);
hr += floor(document.LunarCalc.Min.value)/60;
var tz= floor(document.LunarCalc.ZHour.value);
tz += floor(document.LunarCalc.ZMin.value)/60;
var ln= floor(document.LunarCalc.LonDeg.value);
ln += floor(document.LunarCalc.LonMin.value)/60;
var la= floor(document.LunarCalc.LatDeg.value);
la += floor(document.LunarCalc.LatMin.value)/60;
}
// checks for checked DST, East, South
var dst = document.LunarCalc.DST;
var eln = document.LunarCalc.East;
var sla = document.LunarCalc.South;

if(eln.checked)ln = -ln;
if(sla.checked)la = -la;
if(dst.checked){
if(ln < 0.0)tz++;
else tz--;
}

jd = mdy2julian(mon,day,year);
if(ln < 0.0)f = hr - tz;
else f = hr + tz;
t = (jd - 2451545 - 0.5)/36525;
gst = ut2gst(t,f);
t = ((jd - 2451545) + f/24 - 0.5)/36525;
ay = calcayan(t);

ob = 23.452294 - 0.0130125 * t; // Obliquity of Ecliptic

// Calculate Moon longitude, latitude, and distance using truncated Chapront algorithm

// Moon mean longitude
l = (218.3164591 + 481267.88134236 * t);
// Moon mean elongation
d = (297.8502042 + 445267.1115168 * t);
// Sun's mean anomaly
m = (357.5291092 + 35999.0502909 * t);
// Moon's mean anomaly
mm = (134.9634114 + 477198.8676313 * t);
// Moon's argument of latitude
f = (93.2720993 + 483202.0175273 * t);

d *= d2r; m *= d2r; mm *= d2r; f *= d2r;

e = 1 - 0.002516 * t - 0.0000074 * t * t;

with(Math){
p = 6.288774 * sin(mm)
+ 1.274027 * sin(d*2-mm)
+ 0.658314 * sin(d*2)
+ 0.213618 * sin(2*mm)
- 0.185116 * e * sin(m)
- 0.114332 * sin(f*2);

p += 0.058793 * sin(d*2 - mm * 2)
+ 0.057066 * e * sin(d*2 - m - mm)
+ 0.053322 * sin(d*2 + mm)
+ 0.045758 * e * sin(d*2 - m)
- 0.040923 * e * sin(m - mm)
- 0.034720 * sin(d)
- 0.030383 * e * sin(m + mm);

p += 0.015327 * sin(d*2 - f*2)
- 0.012528 * sin(mm + f*2)
+ 0.010980 * sin(mm - f*2)
+ 0.010675 * sin(d * 4 - mm)
+ 0.010034 * sin(3 * mm);

p += 0.008548 * sin(d * 4 - mm * 2)
- 0.007888 * e * sin(d * 2 + m - mm)
- 0.006766 * e * sin(d * 2 + m)
- 0.005163 * sin(d - mm)
+ 0.004987 * e * sin(d + m)
+ 0.004036 * e * sin(d*2 - m + mm)
+ 0.003994 * sin(d * 2 + mm * 2);

b = 5.128122 * sin(f)
+ 0.280602 * sin(mm+f)
+ 0.277693 * sin(mm-f)
+ 0.173237 * sin(d*2-f)
+ 0.055413 * sin(d*2-mm+f)
+ 0.046271 * sin(d*2-mm-f);

b += 0.032573 * sin(2*d + f)
+ 0.017198 * sin(2*mm + f)
+ 0.009266 * sin(2*d + mm - f)
+ 0.008823 * sin(2*mm - f)
+ 0.008247 * e * sin(2*d - m - f)
+ 0.004324 * sin(2*d - f - 2*mm);

b += 0.004200 * sin(2*d +f+mm)
+ 0.003372 * e * sin(f - m - 2 * d)
+ 0.002472 * e * sin(2*d+f-m-mm)
+ 0.002222 * e * sin(2*d + f - m)
+ 0.002072 * e * sin(2*d-f-m-mm)
+ 0.001877 * e * sin(f-m+mm);

b += 0.001828 * sin(4*d-f-mm)
- 0.001803 * e * sin(f+m)
- 0.001750 * sin(3*f)
+ 0.001570 * e * sin(mm-m-f)
- 0.001487 * sin(f+d)
- 0.001481 * e * sin(f+m+mm);


r = 0.950724 + 0.051818 * cos(mm)
+ 0.009531 * cos(2*d - mm)
+ 0.007843 * cos(2*d)
+ 0.002824 * cos(2*mm)
+ 0.000857 * cos(2*d + mm)
+ 0.000533 * e * cos(2*d - m);

r += 0.000401 * e * cos(2*d-m-mm)
+ 0.000320 * e * cos(mm-m)
- 0.000271 * cos(d)
- 0.000264 * e * cos(m+mm)
- 0.000198 * cos(2*f - mm)
+ 0.000173 * cos(3 * mm);

r += 0.000167 * cos(4*d - mm)
- 0.000111 * e * cos(m)
+ 0.000103 * cos(4*d - 2*mm)
- 0.000084 * cos(2*mm - 2*d)
- 0.000083 * e * cos(2*d + m)
+ 0.000079 * cos(2*d + 2*mm)
+ 0.000072 * cos(4*d);

}

l += p;
while(l < 0.0)l += 360.0;
while(l > 360.0)l -= 360.0;

// Parallax calculations are found in Meeus, Duffett-Smith, Astrologic Almanac (etc)
// Topocentric calculations are done on RA and DEC

// start parallax calculations
ecl2equ(l,b,ob);
ln = -ln; // flip sign of longitude
ln /= 15;
ln += gst;
while(ln < 0.0)ln += 24;
while(ln > 24.0)ln -= 24;
h = (ln - ra) * 15;
with(Math){
// calc observer latitude vars
u = atan(0.996647 * tan(d2r *la));
// hh = alt/6378140; // assume sea level
s = 0.996647 * sin(u); // assume sealevel
c = cos(u); // + hh * cos(d2r(la)); // cos la' -- assume sea level
r = 1/sin(d2r * r);
dlt = atan2(c * sin(d2r*h),r * cos(d2r * dc) - c * cos(d2r* h));
dlt *= r2d;
hh = h + dlt;
dlt /= 15;
ra -= dlt;
dc = atan(cos(d2r * hh) * ((r * sin(d2r * dc) - s)/
(r * cos(d2r *dc) * cos(d2r*h) - c)) );
dc *= r2d;
}
equ2ecl(ra,dc,ob);
// dasha calculations
l += ay;
if(l < 0.0)l += 360.0;
document.display.npmoon.value = lon2dmsz(l);

nk = (l * 60)/800.0; // get nakshatra
with(Math){
document.display.nnakshatra.value = naks[floor(nk)];
nl = floor(nk) % 9;
db = 1 - (nk - floor(nk));
bk = calcbhukti(db,nl);
ndasha = (db * dasha[nl]) * 365.25;
jd1 = jd + ndasha;
d1 = nl;
}
pd = calcpraty(db,nl);

document.display.npdasha.value = lord.substr(nl*2,2) + "/" + lord.substr(bk*2,2)
+ "/" + lord.substr(pd*2,2);
nl++;
if(nl == 9)nl = 0;
str = lord.substr(nl*2,2) + "/" + lord.substr(nl*2,2) + " ";
str += jul2mdy(jd1);
document.display.npnextdasha.value = str;


// Parallax Dasha
pln += ay;
if(pln < 0.0)pln += 360.0;
document.display.pmoon.value = lon2dmsz(pln);

nk = (pln * 60)/800.0; // get nakshatra
with(Math){
document.display.pnakshatra.value = naks[floor(nk)];
nl = floor(nk) % 9;
db = 1 - (nk - floor(nk));

bk = calcbhukti(db,nl);
ndasha = (db * dasha[nl]) * 365.25;
jd2 = jd + ndasha;
jul2mdy(jd2);
diff = round(abs(jd2-jd1)); // find difference in days
if(d1 != nl){
if(d1 < nl)
diff = dasha[nl] * 365.25 - diff;
else
diff = dasha[d1] * 365.25 - diff;
diff = round(abs(diff));
}
pd = calcpraty(db,nl);
document.display.pdasha.value = lord.substr(nl*2,2) + "/" + lord.substr(bk*2,2)
+ "/" + lord.substr(pd*2,2);

nl++;
if(nl == 9)nl = 0;
str = lord.substr(nl*2,2) + "/" + lord.substr(nl*2,2) + " ";
str += jul2mdy(jd2);
document.display.pnextdasha.value = str;
// display difference in years, months, days
str = "";
x = floor(diff/365.25);
if(x){
str = x + " year ";
diff -= 365.25;
}
x = floor(diff/30);
if(x)str += x + " month(s) ";
str += floor(diff % 30) + " days";
document.display.diff.value = str;
}

// Calculate current dasha/bhukti
// do something if it is the current or future date
today = new Date();
mon = today.getMonth() + 1;
day = today.getDate();
year = today.getFullYear();
curjd = mdy2julian(mon,day,year);
cd = curjd - jd1;
d1++;
if(d1 == 9)d1= 0;
document.display.curdasha.value = calccurdasha(cd,d1);
cd = curjd - jd2;
document.display.curpdasha.value = calccurdasha(cd,nl);

}

function calccurdasha(cd,nl)
{
// check for > 120 years
while(cd < 0)cd += 43830;
len = 0;
for(i = 0; i < 9; i++){
len += dasha[nl] * 365.25;
if(len > cd)break;
nl++;
if(nl == 9)nl = 0;
}
cd = len - cd;
cd /= dasha[nl] * 365.25
bk = calcbhukti(cd,nl);
pd = calcpraty(cd,nl);
str = lord.substr(nl*2,2) + "/" + lord.substr(bk*2,2) + "/"
+ lord.substr(pd*2,2);
return str;
}

function calcbhukti(db,dp)
{
x = 1 - db; // find days elapsed
y = 0;
var buk = dp;
for(i = 0; i < 9; i++){
y += dasha[buk]/120; // percentage of period
if(y > x)break;
buk++;
if(buk == 9)buk = 0;
}
return buk;
}

function calcpraty(db,dp)
{
x = 1 - db; // find days elapsed
y = 0;
bk1 = dp;
for(i = 0; i < 9; i++){
y += dasha[bk1]/120; // percentage of period
if(y > x)break;
bk1++;
if(bk1 == 9)bk1 = 0;
}
y = y - x; // find days left over
y = y/(dasha[bk1]/120); // % of this bukti to go
return calcbhukti(y,bk1);
}

// Calculate Ayanamsa using J2000 Epoch
function calcayan(t)
{
with(Math){
ln = 125.0445550 - 1934.1361849 * t + 0.0020762 * t * t; // Mean lunar node
off = 280.466449 + 36000.7698231 * t + 0.00031060 * t * t; // Mean Sun
off = 17.23*sin(d2r * ln)+1.27*sin(d2r * off)-(5025.64+1.11*t)*t;
off = (off- 85886.27)/3600.0;
}
return off;
}

function jul2mdy(JD)
{
var str;
with(Math){
L = floor(JD + 0.5)+68569;
N = floor((4*L)/146097);
L -= floor((146097*N + 3)/4);
IT = floor((4000*(L+1))/1461001);
L -= floor((1461*IT)/4) - 31;
JT = floor((80*L)/2447);
K = L- floor((2447*JT)/80);
L = floor(JT/11);
JT += 2 - 12*L;
IK = 100*(N-49) + IT + L;
str = "(M/D/Y) ";
str += floor(JT); // month
str += "/" + floor(K); // day
str += "/" + floor(IK); // year
}
return str;
}

function ut2gst(t,ut)
{
t0 = 6.697374558 + (2400.051336 * t) + (0.000025862 * t * t);
ut *= 1.002737909;
t0 += ut;
while(t0 < 0.0)t0 += 24;
while(t0 > 24.0)t0 -= 24;
return t0;
}

function ecl2equ(ln,la,ob)
{
with(Math){
y = asin(sin(d2r *la ) * cos(d2r * ob ) + cos(d2r *la ) * sin(d2r *ob ) * sin(d2r * ln));
dc = r2d * y;
y = sin(d2r *ln ) * cos(d2r * ob) - tan(d2r * la) * sin(d2r * ob);
x = cos(d2r * ln);
x = atan2(y,x);
x = r2d * x;
if(x < 0.0)x += 360;
ra = x/15;
}
}

function equ2ecl(ra,dc,ob)
{
ra *= 15;
with(Math){
y = sin(d2r *ra) * cos(d2r * ob) + tan(d2r *dc) * sin(d2r * ob);
x = cos(d2r * ra);
x = atan2(y,x);
x *= r2d;
if(x < 0)x += 360;
pln = x;
y = asin(sin(d2r * dc) * cos(d2r * ob) - cos(d2r * dc) * sin(d2r * ob) * sin(d2r * ra));
pla = r2d * y;
}
}

// build string with degrees, minutes, seconds and zodiac sign from longitude
function lon2dmsz(x)
{
with(Math){
var d,m,s;
x = abs(x);
d = floor(x);
m = (x - d);
s = m * 60;
m = floor(s);
s = s - m;
z = floor(d/30);
d %= 30;
str = d + "� " + m + "' " + floor(s * 60) + "\" " + zn.substr(z*3,3);
}
return str;
}
// calculate Julian Day from Month, Day and Year
function mdy2julian(m,d,y)
{
with(Math){
im = 12 * (y + 4800) + m - 3;
j = (2 * (im - floor(im/12) * 12) + 7 + 365 * im)/12;
j = floor(j) + d + floor(im/48) - 32083;
if(j > 2299171)j += floor(im/4800) - floor(im/1200) + 38;
return j;
}
}

// keep within 360 degrees
function fix360(v)
{
while(v < 0.0)v += 360;
while(v > 360)v -= 360;
return v;
}

</script>
</body>
</html>
astrosanthosh
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Apr 06, 2013 5:09 am

Re: need help in calculating vimshottari dasha

Postby seandisanti » Mon Apr 15, 2013 8:37 am

1) please use [ code] [ /code] tags (without the leading spaces) around code in posts to help readability.
2) we are here to help, not work for free. Make an effort and let us know how the achieved results differ from the desired results, and we'll help bring the result sets together and troubleshoot errors.
3) If you just want someone to do the work for you, there's a php=> jobs section where you can post your task and how much you're looking to pay.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: need help in calculating vimshottari dasha

Postby astrosanthosh » Tue Apr 16, 2013 8:01 am

Sorry, I am new to this kind of groups, i dont know how to post this kind of posts. Sure I will ask someone who works for me. I can pay if they ready to work.
Thanks for your help
astrosanthosh
New php-forum User
New php-forum User
 
Posts: 3
Joined: Sat Apr 06, 2013 5:09 am

Re: need help in calculating vimshottari dasha

Postby seandisanti » Tue Apr 16, 2013 10:22 am

Nothing to be sorry about, was just giving you tips so that you get the help you're looking for.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron