Curvature

>function dsf(fx,fy,t) &&= sqrt(diff(fx,t)^2+diff(fy,t)^2)
2 2
sqrt(diff (fy, t) + diff (fx, t))
>&assume(r>0); &trigsimp(dsf(r*cos(2*pi*x),r*sin(2*pi*x),x))
2 pi r

>&integrate(dsf(x,x^2,x),x,-1,1), %()
asinh(2) + 2 sqrt(5)
--------------------
2
2.95788571509
>t=-1:0.01:1; s=t^2; n=cols(t); ...
> sum(sqrt((differences(t))^2+(differences(s))^2))
2.95787080795


>gx &= r*cos(om*t); gy &= r*sin(om*t); ...
> &trigsimp(diff(gx,t)*diff(gy,t,2)-diff(gy,t)*diff(gx,t,2))
3 2
om r
>&trigsimp(dsf(gx,gy,t))
abs(om) r

>function kr(fx,fy,t) &&= dsf(fx,fy,t)^3 ...
> /abs(diff(fx,t)*diff(fy,t,2)-diff(fx,t,2)*diff(fy,t))
3
dsf (fx, fy, t)
------------------------------------------------------------
abs(diff(fx, t) diff(fy, t, 2) - diff(fx, t, 2) diff(fy, t))
>&assume(r>0); &trigsimp(kr(r*cos(om*x),r*sin(om*x),x))
r
>&ratsimp(kr(t,t^2,t))
2 3/2
(4 t + 1)
-------------
2

>&depends(f,t); $kr(t,f,t)

>function kra(fx,fy,t) &&= dsf(fx,fy,t)^2 ...
> /(diff(fx,t)*diff(fy,t,2)-diff(fx,t,2)*diff(fy,t))
2
dsf (fx, fy, t)
-------------------------------------------------------
diff(fx, t) diff(fy, t, 2) - diff(fx, t, 2) diff(fy, t)
>function ux(fx,fy,t) &&= fx-diff(fy,t)*kra(fx,fy,t)
fx - kra(fx, fy, t) diff(fy, t)
>function uy(fx,fy,t) &&= fy+diff(fx,t)*kra(fx,fy,t)
fy + kra(fx, fy, t) diff(fx, t)
>function krm(fx,fy,t) &&= [ux(fx,fy,t),uy(fx,fy,t)]
[ux(fx, fy, t), uy(fx, fy, t)]
>&trigsimp(krm(r*cos(x),r*sin(x),x))
[0, 0]
>&ratsimp(krm(x,x^2,x))
2
3 6 x + 1
[- 4 x , --------]
2
>plot2d("x","x^2",xmin=-1,xmax=1,a=-1.5,b=1.5,c=-1,d=2);
>plot2d(mxm("ux(x,x^2,x)"),mxm("uy(x,x^2,x)"),xmin=-1,xmax=1,color=2,add=1);
>xt=0; m=mxmeval("krm(x,x^2,x)",x=xt); r=mxmeval("kr(x,x^2,x)",x=xt);
>plot2d("m[1]+cos(x)*r","m[2]+sin(x)*r",xmin=0,xmax=2*pi,add=1,color=2);
>plot2d(m[1],m[2],points=1,style="o",add=1); insimg;

>a=1; k=0.15; plot2d("a*exp(k*x)*cos(x)","a*exp(k*x)*sin(x)", ...
> xmin=-4*pi,xmax=4*pi,r=7,n=500); insimg;

>a=1; k=0.15;
>plot2d("a*exp(k*x)*cos(x)","a*exp(k*x)*sin(x)",xmin=0,xmax=2*pi,r=3,n=500);
>&assume(a>0); &ratsimp(krm(a*exp(k*t)*cos(t),a*exp(k*t)*sin(t),t))
k t k t
[- a k E sin(t), a k E cos(t)]
>plot2d("-a*k*exp(k*x)*sin(x)","a*k*exp(k*x)*cos(x)", ...
> color=2,xmin=0,xmax=2*pi,add=1,n=500); insimg;

>a=2; plot2d("x*cos(a*x)","x*sin(a*x)",xmin=0,xmax=2*pi,r=8,n=500);
>&assume(a>0); &ratsimp(krm(x*cos(a*x),x*sin(a*x),x))
2 2
a x cos(a x) - (a x + 1) sin(a x)
[-----------------------------------,
3 2
a x + 2 a
2 2
a x sin(a x) + (a x + 1) cos(a x)
-----------------------------------]
3 2
a x + 2 a
>plot2d(mxm("ux(x*cos(a*x),x*sin(a*x),x)"), ...
> mxm("uy(x*cos(a*x),x*sin(a*x),x)"),xmin=0,xmax=2*pi,add=1,color=2); insimg;

>
Examples Homepage