%% Curve Invariants -- Alternate
% These are commands for computing the speed and curvature of a non-unit
% speed parametrized curve.

% In the following, r = [x(t), y(t), z(t)] is a parametrized curve. For
% each such curve, the following program computes its speed and curvature.

veclength = @(x) sqrt(x*transpose(x));
vel = diff(r,t);
speed = veclength(vel);
accel = diff(vel, t);
vta = simplify(cross([vel,0], [accel,0]));
curvature = simplify(veclength(vta)/speed^3);
sqspeed = simplify(speed^2, 'Steps', 50);
pretty(sqspeed)
sqcurv = simplify(curvature^2, 'Steps', 50);
pretty(sqcurv)