Analytic trajectories

Main author: Simon Rohou

AnalyticTraj represents a trajectory defined by a function of time rather than by stored samples. It combines a temporal domain and an AnalyticFunction with one scalar input.

Construction

Define a ScalarVar for time, create an AnalyticFunction and pass the domain before the function to AnalyticTraj.

t = ScalarVar()
f = AnalyticFunction([t], 2*sin(t))
traj_f = AnalyticTraj([0,2], f) # scalar trajectory

g = AnalyticFunction([t], [cos(t), sin(t)])
traj_g = AnalyticTraj([0,2], g) # vector trajectory

Evaluation

x(t) evaluates the function at a given time. x([a,b]) computes an interval enclosure over the time interval using, by default, the intersection of the natural and centered forms to reduce overestimation. If the centered form is unavailable, only the natural evaluation is used.

y_point = traj_f(0.5)      # scalar value
y_interval = traj_f([0,1]) # interval enclosure
p_point = traj_g(0.5)      # vector value

Sampling

sampled(dt) constructs a SampledTraj at regular instants, including the final time. The resulting interpolation is generally different from the original analytic function between samples.

f_samples = traj_f.sampled(0.1)
g_samples = traj_g.sampled(0.1)

Other operations

tdomain(), codomain(), size() and truncate_tdomain() provide the usual trajectory properties. sampled_as(reference) evaluates at the reference timestamps. as_function() embeds the trajectory into an analytic expression.

t = ScalarVar()
a = AnalyticTraj([0,2], AnalyticFunction([t], sqr(t)))
f = a.as_function()
g = AnalyticFunction([t], f(t) + 1)

For numerical integration with primitive(dt), see Operations on trajectories. An analytic trajectory may also initialize a Sliced tubes. Its symbolic expression is not serialized directly. See Trajectories serialization.