How to make a incremental function more efficient with a variable "x"

Hi there,

I’m pretty new to the scripting here, so I apologise if this was explained somewhere very clear. I have not been able to find the answer for this yet.

So I’m looking for a way to get incremental values fitting within the circle of 360, without having to write out all the increments within the circle.

Ideally i would like to have a variable “x” and then having the increments of x within the circle.

At the moment i have this formula:

d1 = PDIFF(PLANET1=[Mars], PLANET2=[Jupiter], GMT=0:00);

p1 = PVAL(PLANET=[Mars], GMT=0:00);
p2 = PVAL(PLANET=[Jupiter], GMT=0:00);

P1 - p2 Crosses 0
or
d1 Crosses 6
or
d1 Crosses 12
or
d1 Crosses 18
or
d1 Crosses 24

etc… until 354

I have 2x PVAL function in there so that I can see the 0 / 360 crossing. I was not able to get that out with the PDIFF function. Maybe there is a way for this?

As you can see writing out all the degree differences takes to long for testing purposes. Is there a way to make this formula more efficient?

Any help would be greatly appreciated.

No one that can point me in to the right direction ? Any help would be highly appreciated.

Hi,

Have you tried the Time by Synodic Degrees tool? This lets you set an interval (6 degrees in this case) to mark movement between 2 planets.

TBSYN(LEVELS=[6], PLANETS=[Mars], PLANET2=[Jupiter], GMT=.00)

This may be a more straightforward way to get the result you are after.

If you are trying for something different and need more control, you can try a manual calculation, something like this would work:

d1 = PDIFF(PLANET1=[Mars], PLANET2=[Jupiter], GMT=0:00); // Angular difference between Mars and Jupiter
d2 = d1 - d1[1]; // Daily change in angular difference
d3 = ABS(d2); // Absolute daily change
acc1 = ACC(d3); // Cumulative absolute angular change

// Detect crossings of exact 6-degree multiples
crossing = FLOOR(acc1 / 6) > FLOOR(acc1[1] / 6);

// Output the crossing signal
crossing