Orbital elements: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
Line 35: Line 35:
{{trans|Python}}
{{trans|Python}}


<lang 11l>F mulAdd(v1, x1, v2, x2)
<syntaxhighlight lang="11l">F mulAdd(v1, x1, v2, x2)
R v1 * x1 + v2 * x2
R v1 * x1 + v2 * x2


Line 69: Line 69:
V ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
V ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
print(‘Position : ’ps[0])
print(‘Position : ’ps[0])
print(‘Speed : ’ps[1])</lang>
print(‘Speed : ’ps[1])</syntaxhighlight>


{{out}}
{{out}}
Line 79: Line 79:
=={{header|Ada}}==
=={{header|Ada}}==
{{Trans|Kotlin}}
{{Trans|Kotlin}}
<lang Ada>with Ada.Text_IO; use Ada.Text_IO;
<syntaxhighlight lang="ada">with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Numerics.Generic_Real_Arrays;
with Ada.Numerics.Generic_Elementary_Functions;
with Ada.Numerics.Generic_Elementary_Functions;
Line 184: Line 184:
Put ("Position : "); Put (State.Position); New_Line;
Put ("Position : "); Put (State.Position); New_Line;
Put ("Speed : "); Put (State.Speed); New_Line;
Put ("Speed : "); Put (State.Speed); New_Line;
end Orbit;</lang>
end Orbit;</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 193: Line 193:
=={{header|ALGOL W}}==
=={{header|ALGOL W}}==
{{Trans|C}} (which is a translation of Kotlin which is a translation of ...).
{{Trans|C}} (which is a translation of Kotlin which is a translation of ...).
<lang algolw>begin
<syntaxhighlight lang="algolw">begin
% compute orbital elements %
% compute orbital elements %
% 3-element vector %
% 3-element vector %
Line 277: Line 277:
write( "Speed : " ); writeOnVector( speed )
write( "Speed : " ); writeOnVector( speed )
end
end
end.</lang>
end.</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 285: Line 285:
=={{header|C}}==
=={{header|C}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang c>#include <stdio.h>
<syntaxhighlight lang="c">#include <stdio.h>
#include <math.h>
#include <math.h>


Line 360: Line 360:
printf("Speed : %s\n", buffer);
printf("Speed : %s\n", buffer);
return 0;
return 0;
}</lang>
}</syntaxhighlight>


{{output}}
{{output}}
Line 370: Line 370:
=={{header|C sharp|C#}}==
=={{header|C sharp|C#}}==
{{trans|D}}
{{trans|D}}
<lang csharp>using System;
<syntaxhighlight lang="csharp">using System;


namespace OrbitalElements {
namespace OrbitalElements {
Line 455: Line 455:
}
}
}
}
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.77942284339868, 0.450000034653684, 0)
<pre>Position : (0.77942284339868, 0.450000034653684, 0)
Line 462: Line 462:
=={{header|C++}}==
=={{header|C++}}==
{{trans|C#}}
{{trans|C#}}
<lang cpp>#include <iostream>
<syntaxhighlight lang="cpp">#include <iostream>
#include <tuple>
#include <tuple>


Line 558: Line 558:


return 0;
return 0;
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.779423, 0.45, 0)
<pre>Position : (0.779423, 0.45, 0)
Line 565: Line 565:
=={{header|D}}==
=={{header|D}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang D>import std.math;
<syntaxhighlight lang="d">import std.math;
import std.stdio;
import std.stdio;
import std.typecons;
import std.typecons;
Line 653: Line 653:
writeln("Position : ", res[0]);
writeln("Position : ", res[0]);
writeln("Speed : ", res[1]);
writeln("Speed : ", res[1]);
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.7794228433986798, 0.4500000346536842, 0.0000000000000000)
<pre>Position : (0.7794228433986798, 0.4500000346536842, 0.0000000000000000)
Line 660: Line 660:
=={{header|Go}}==
=={{header|Go}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang go>package main
<syntaxhighlight lang="go">package main


import (
import (
Line 731: Line 731:
fmt.Println("Position :", position)
fmt.Println("Position :", position)
fmt.Println("Speed :", speed)
fmt.Println("Speed :", speed)
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 740: Line 740:


=={{header|J}}==
=={{header|J}}==
{{trans|Raku}}<lang J>NB. euler rotation matrix, left hand rule
{{trans|Raku}}<syntaxhighlight lang="j">NB. euler rotation matrix, left hand rule
NB. x: axis (0, 1 or 2), y: angle in radians
NB. x: axis (0, 1 or 2), y: angle in radians
R=: {{ ((2 1,:1 2) o.(,-)y*_1^2|x)(,&.>/~0 1 2-.x)} =i.3 }}
R=: {{ ((2 1,:1 2) o.(,-)y*_1^2|x)(,&.>/~0 1 2-.x)} =i.3 }}
Line 761: Line 761:
speed=. (%:(2%ra)-%a)*norm(rp,ra,0) X ijk
speed=. (%:(2%ra)-%a)*norm(rp,ra,0) X ijk
position,:speed
position,:speed
}}</lang>
}}</syntaxhighlight>


The true anomaly, argument of Periapsis, Longitude of the ascending node and inclination are all angles. And we use the dot product of their rotation matrices (in that order) to find the orientation of the orbit and the object's position in that orbit. Here, <code>R</code> finds the rotation matrix for a given angle around a given axis. Here's an example of what R gives us for a sixty degree angle:
The true anomaly, argument of Periapsis, Longitude of the ascending node and inclination are all angles. And we use the dot product of their rotation matrices (in that order) to find the orientation of the orbit and the object's position in that orbit. Here, <code>R</code> finds the rotation matrix for a given angle around a given axis. Here's an example of what R gives us for a sixty degree angle:


<lang J> 0 1 2 R&.> 60r180p1 NB. rotate around first, second or third axis
<syntaxhighlight lang="j"> 0 1 2 R&.> 60r180p1 NB. rotate around first, second or third axis
┌────────────────────┬────────────────────┬────────────────────┐
┌────────────────────┬────────────────────┬────────────────────┐
│1 0 0│ 0.5 0 _0.866025│ 0.5 0.866025 0│
│1 0 0│ 0.5 0 _0.866025│ 0.5 0.866025 0│
│0 0.5 0.866025│ 0 1 0│_0.866025 0.5 0│
│0 0.5 0.866025│ 0 1 0│_0.866025 0.5 0│
│0 _0.866025 0.5│0.866025 0 0.5│ 0 0 1│
│0 _0.866025 0.5│0.866025 0 0.5│ 0 0 1│
└────────────────────┴────────────────────┴────────────────────┘</lang>
└────────────────────┴────────────────────┴────────────────────┘</syntaxhighlight>


Task example:<lang J> orbitalStateVectors 1 0.1 0 355r678 0 0
Task example:<syntaxhighlight lang="j"> orbitalStateVectors 1 0.1 0 355r678 0 0
0.779423 0.45 0
0.779423 0.45 0
_0.552771 0.957427 0</lang>
_0.552771 0.957427 0</syntaxhighlight>


=={{header|Java}}==
=={{header|Java}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang Java>public class OrbitalElements {
<syntaxhighlight lang="java">public class OrbitalElements {
private static class Vector {
private static class Vector {
private double x, y, z;
private double x, y, z;
Line 858: Line 858:
System.out.printf("Speed : %s\n", ps[1]);
System.out.printf("Speed : %s\n", ps[1]);
}
}
}</lang>
}</syntaxhighlight>


{{out}}
{{out}}
Line 868: Line 868:
{{works with|jq}}
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
'''Works with gojq, the Go implementation of jq'''
<lang jq># Array/vector operations
<syntaxhighlight lang="jq"># Array/vector operations
def addVectors: transpose | map(add);
def addVectors: transpose | map(add);


Line 904: Line 904:
| divide(abs)
| divide(abs)
| multiply( ((2 / $r) - (1 / semimajorAxis))|sqrt) as $speed
| multiply( ((2 / $r) - (1 / semimajorAxis))|sqrt) as $speed
| [$position, $speed] ;</lang>
| [$position, $speed] ;</syntaxhighlight>
'''The Task'''
'''The Task'''
<lang jq>orbitalStateVectors(1; 0.1; 0; 355 / (113 * 6); 0; 0)
<syntaxhighlight lang="jq">orbitalStateVectors(1; 0.1; 0; 355 / (113 * 6); 0; 0)
| "Position : \(.[0])",
| "Position : \(.[0])",
"Speed : \(.[1])"</lang>
"Speed : \(.[1])"</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 917: Line 917:
=={{header|Julia}}==
=={{header|Julia}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang julia>using GeometryTypes
<syntaxhighlight lang="julia">using GeometryTypes
import Base.abs, Base.print
import Base.abs, Base.print


Line 952: Line 952:


testorbitalmath()
testorbitalmath()
</lang>{{out}}
</syntaxhighlight>{{out}}
<pre>
<pre>
Position : (0.7794228433986797, 0.45000003465368416, 0.0)
Position : (0.7794228433986797, 0.45000003465368416, 0.0)
Line 960: Line 960:
=={{header|Kotlin}}==
=={{header|Kotlin}}==
{{trans|Sidef}}
{{trans|Sidef}}
<lang scala>// version 1.1.4-3
<syntaxhighlight lang="scala">// version 1.1.4-3


class Vector(val x: Double, val y: Double, val z: Double) {
class Vector(val x: Double, val y: Double, val z: Double) {
Line 1,023: Line 1,023:
println("Position : $position")
println("Position : $position")
println("Speed : $speed")
println("Speed : $speed")
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.7794228433986797, 0.45000003465368416, 0.0)
<pre>Position : (0.7794228433986797, 0.45000003465368416, 0.0)
Line 1,030: Line 1,030:
=={{header|Nim}}==
=={{header|Nim}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang Nim>import math, strformat
<syntaxhighlight lang="nim">import math, strformat


type Vector = tuple[x, y, z: float]
type Vector = tuple[x, y, z: float]
Line 1,086: Line 1,086:
trueAnomaly = 0.0)
trueAnomaly = 0.0)
echo "Position: ", position
echo "Position: ", position
echo "Speed: ", speed</lang>
echo "Speed: ", speed</syntaxhighlight>


{{out}}
{{out}}
Line 1,094: Line 1,094:
=={{header|ooRexx}}==
=={{header|ooRexx}}==
{{trans|Java}}
{{trans|Java}}
<lang oorexx>/* REXX */
<syntaxhighlight lang="oorexx">/* REXX */
Numeric Digits 16
Numeric Digits 16
ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
Line 1,200: Line 1,200:
Return res
Return res


::requires 'rxmath' LIBRARY</lang>
::requires 'rxmath' LIBRARY</syntaxhighlight>


{{out}}
{{out}}
Line 1,211: Line 1,211:
=={{header|Perl}}==
=={{header|Perl}}==
{{trans|Raku}}
{{trans|Raku}}
<lang perl>use strict;
<syntaxhighlight lang="perl">use strict;
use warnings;
use warnings;
use Math::Vector::Real;
use Math::Vector::Real;
Line 1,270: Line 1,270:
0, # argument of periapsis
0, # argument of periapsis
0 # true-anomaly
0 # true-anomaly
;</lang>
;</syntaxhighlight>
{{out}}
{{out}}
<pre>$VAR1 = {
<pre>$VAR1 = {
Line 1,287: Line 1,287:
=={{header|Phix}}==
=={{header|Phix}}==
{{trans|Python}}
{{trans|Python}}
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">vabs</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">v</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">vabs</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">v</span><span style="color: #0000FF;">)</span>
Line 1,327: Line 1,327:
<span style="color: #000000;">orbitalStateVectors</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.1</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">355.0</span> <span style="color: #0000FF;">/</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">113.0</span> <span style="color: #0000FF;">*</span> <span style="color: #000000;">6.0</span><span style="color: #0000FF;">),</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">orbitalStateVectors</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.1</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">355.0</span> <span style="color: #0000FF;">/</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">113.0</span> <span style="color: #0000FF;">*</span> <span style="color: #000000;">6.0</span><span style="color: #0000FF;">),</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
{{out}}
{{out}}
<pre>
<pre>
Line 1,339: Line 1,339:
This implementation uses the CLP/R library of swi-prolog, but doesn't have to. This removes the need for a vector divide and has limited capability to reverse the functionality (eg: given the position/speed find some orbital elements).
This implementation uses the CLP/R library of swi-prolog, but doesn't have to. This removes the need for a vector divide and has limited capability to reverse the functionality (eg: given the position/speed find some orbital elements).


<lang Prolog>:- use_module(library(clpr)).
<syntaxhighlight lang="prolog">:- use_module(library(clpr)).


v3_add(v(X1,Y1,Z1),v(X2,Y2,Z2),v(X,Y,Z)) :-
v3_add(v(X1,Y1,Z1),v(X2,Y2,Z2),v(X,Y,Z)) :-
Line 1,397: Line 1,397:
find_l(Ecc, SemiMajor, L) :-
find_l(Ecc, SemiMajor, L) :-
dif(Ecc,1.0),
dif(Ecc,1.0),
{ L = SemiMajor * (1.0 - Ecc * Ecc) }.</lang>
{ L = SemiMajor * (1.0 - Ecc * Ecc) }.</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,408: Line 1,408:


=={{header|Python}}==
=={{header|Python}}==
<lang python>import math
<syntaxhighlight lang="python">import math


class Vector:
class Vector:
Line 1,466: Line 1,466:
ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
ps = orbitalStateVectors(1.0, 0.1, 0.0, 355.0 / (113.0 * 6.0), 0.0, 0.0)
print "Position :", ps[0]
print "Position :", ps[0]
print "Speed :", ps[1]</lang>
print "Speed :", ps[1]</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.787295801413, 0.454545489549, 0.0)
<pre>Position : (0.787295801413, 0.454545489549, 0.0)
Line 1,474: Line 1,474:
(formerly Perl 6)
(formerly Perl 6)
We'll use the [https://github.com/grondilu/clifford Clifford geometric algebra library] but only for the vector operations.
We'll use the [https://github.com/grondilu/clifford Clifford geometric algebra library] but only for the vector operations.
<lang perl6>sub orbital-state-vectors(
<syntaxhighlight lang="raku" line>sub orbital-state-vectors(
Real :$semimajor-axis where * >= 0,
Real :$semimajor-axis where * >= 0,
Real :$eccentricity where * >= 0,
Real :$eccentricity where * >= 0,
Line 1,517: Line 1,517:
longitude-of-ascending-node => pi/6,
longitude-of-ascending-node => pi/6,
argument-of-periapsis => pi/4,
argument-of-periapsis => pi/4,
true-anomaly => 0;</lang>
true-anomaly => 0;</syntaxhighlight>
{{out}}
{{out}}
<pre>{position => 0.237771283982207*e0+0.860960261697716*e1+0.110509023572076*e2, speed => -1.06193301748006*e0+0.27585002056925*e1+0.135747024865598*e2}</pre>
<pre>{position => 0.237771283982207*e0+0.860960261697716*e1+0.110509023572076*e2, speed => -1.06193301748006*e0+0.27585002056925*e1+0.135747024865598*e2}</pre>
Line 1,525: Line 1,525:
{{trans|Java}}
{{trans|Java}}
Vectors are represented by strings: 'x/y/z'
Vectors are represented by strings: 'x/y/z'
<lang rexx>/* REXX */
<syntaxhighlight lang="rexx">/* REXX */
Numeric Digits 16
Numeric Digits 16
Parse Value orbitalStateVectors(1.0,0.1,0.0,355.0/(113.0*6.0),0.0,0.0),
Parse Value orbitalStateVectors(1.0,0.1,0.0,355.0/(113.0*6.0),0.0,0.0),
Line 1,660: Line 1,660:
End
End
Numeric Digits prec
Numeric Digits prec
Return r+0</lang>
Return r+0</syntaxhighlight>
{{out}}
{{out}}
<pre>Position : (0.7794228433986798,0.4500000346536842,0)
<pre>Position : (0.7794228433986798,0.4500000346536842,0)
Line 1,667: Line 1,667:
===version 2===
===version 2===
Re-coding of REXX version 1, &nbsp; but with greater decimal digits precision.
Re-coding of REXX version 1, &nbsp; but with greater decimal digits precision.
<lang rexx>/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/
<syntaxhighlight lang="rexx">/*REXX pgm converts orbital elements ──► orbital state vectors (angles are in radians).*/
numeric digits length( pi() ) - length(.) /*limited to pi len, but show 1/3 digs.*/
numeric digits length( pi() ) - length(.) /*limited to pi len, but show 1/3 digs.*/
call orbV 1, .1, 0, 355/113/6, 0, 0 /*orbital elements taken from: Java */
call orbV 1, .1, 0, 355/113/6, 0, 0 /*orbital elements taken from: Java */
Line 1,718: Line 1,718:
numeric digits; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g= g *.5'e'_ % 2
numeric digits; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g= g *.5'e'_ % 2
do j=0 while h>9; m.j= h; h= h % 2 + 1; end
do j=0 while h>9; m.j= h; h= h % 2 + 1; end
do k=j+5 to 0 by '-1'; numeric digits m.k; g= (g+x/g) * .5; end; return g</lang>
do k=j+5 to 0 by '-1'; numeric digits m.k; g= (g+x/g) * .5; end; return g</syntaxhighlight>
{{out|output|text=&nbsp; when using the default internal inputs:}}
{{out|output|text=&nbsp; when using the default internal inputs:}}
<pre>
<pre>
Line 1,743: Line 1,743:


=={{header|Scala}}==
=={{header|Scala}}==
<lang Scala>import scala.language.existentials
<syntaxhighlight lang="scala">import scala.language.existentials


object OrbitalElements extends App {
object OrbitalElements extends App {
Line 1,785: Line 1,785:
}
}


}</lang>
}</syntaxhighlight>
{{Out}}Best seen running in your browser either by [https://scalafiddle.io/sf/ac17jh2/0 ScalaFiddle (ES aka JavaScript, non JVM)] or [https://scastie.scala-lang.org/2NQNgj4OQkazxZNvSzcexQ Scastie (remote JVM)].
{{Out}}Best seen running in your browser either by [https://scalafiddle.io/sf/ac17jh2/0 ScalaFiddle (ES aka JavaScript, non JVM)] or [https://scastie.scala-lang.org/2NQNgj4OQkazxZNvSzcexQ Scastie (remote JVM)].


=={{header|Sidef}}==
=={{header|Sidef}}==
{{trans|Perl}}
{{trans|Perl}}
<lang ruby>func orbital_state_vectors(
<syntaxhighlight lang="ruby">func orbital_state_vectors(
semimajor_axis,
semimajor_axis,
eccentricity,
eccentricity,
Line 1,846: Line 1,846:
say "Position : #{r.position}"
say "Position : #{r.position}"
say "Speed : #{r.speed}\n"
say "Speed : #{r.speed}\n"
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,862: Line 1,862:
{{trans|Kotlin}}
{{trans|Kotlin}}


<lang swift>import Foundation
<syntaxhighlight lang="swift">import Foundation


public struct Vector {
public struct Vector {
Line 1,964: Line 1,964:
)
)


print("Position: \(position); Speed: \(speed)")</lang>
print("Position: \(position); Speed: \(speed)")</syntaxhighlight>


{{out}}
{{out}}
Line 1,972: Line 1,972:
=={{header|Wren}}==
=={{header|Wren}}==
{{trans|Kotlin}}
{{trans|Kotlin}}
<lang ecmascript>class Vector {
<syntaxhighlight lang="ecmascript">class Vector {
construct new(x, y, z) {
construct new(x, y, z) {
_x = x
_x = x
Line 2,030: Line 2,030:
var ps = orbitalStateVectors.call(1, 0.1, 0, 355 / (113 * 6), 0, 0)
var ps = orbitalStateVectors.call(1, 0.1, 0, 355 / (113 * 6), 0, 0)
System.print("Position : %(ps[0])")
System.print("Position : %(ps[0])")
System.print("Speed : %(ps[1])")</lang>
System.print("Speed : %(ps[1])")</syntaxhighlight>


{{out}}
{{out}}
Line 2,040: Line 2,040:
=={{header|zkl}}==
=={{header|zkl}}==
{{trans|Perl}}
{{trans|Perl}}
<lang zkl>fcn orbital_state_vectors(semimajor_axis, eccentricity, inclination,
<syntaxhighlight lang="zkl">fcn orbital_state_vectors(semimajor_axis, eccentricity, inclination,
longitude_of_ascending_node, argument_of_periapsis, true_anomaly){
longitude_of_ascending_node, argument_of_periapsis, true_anomaly){
i,j,k:=T(1.0, 0.0, 0.0), T(0.0, 1.0, 0.0), T(0.0, 0.0, 1.0);
i,j,k:=T(1.0, 0.0, 0.0), T(0.0, 1.0, 0.0), T(0.0, 0.0, 1.0);
Line 2,069: Line 2,069:
return(position,speed);
return(position,speed);
}</lang>
}</syntaxhighlight>
<lang zkl>orbital_state_vectors(
<syntaxhighlight lang="zkl">orbital_state_vectors(
1.0, # semimajor axis
1.0, # semimajor axis
0.1, # eccentricity
0.1, # eccentricity
Line 2,077: Line 2,077:
0.0, # argument of periapsis
0.0, # argument of periapsis
0.0 # true-anomaly
0.0 # true-anomaly
).println();</lang>
).println();</syntaxhighlight>
{{out}}
{{out}}
<pre>L(L(0.779423,0.45,0),L(-0.552771,0.957427,0))</pre>
<pre>L(L(0.779423,0.45,0),L(-0.552771,0.957427,0))</pre>