Yes! Like that. And by gum I understand as well. kappa computes curvature of parametric curve, and its reciprocal is the radius of curvature.

mp=: $:~ :(+/ .*)
abs=: [: %: mp
det=: -/ .*

cross=: (1 |. [: , (0 1,:2) det;._3 ,:&(,{.)"1) ([: :)
assert 0 _1 0 -: 1 0 0 cross 0 0 1

dgerund=: 3 :'{.(y`:6 d.1)`*'"0

NB. compute radius of curvature for parametric curve

NB. kappa is curvature
kappa=: 4 :0
 Dx=. dgerund x
 Ddx=. dgerund Dx
 dx=. Dx`:0
 ddx=. Ddx`:0
 (([: abs (dx cross ddx)) % (3 ^~ [: abs dx)) y
)

NB. curvature of circle test
assert 1 -: (2&o.)`(1&o.)`0:kappa 9

NB. radius of curvature is reciprocal of curvature
rc=: [: % kappa
Date: Tue, 3 Nov 2015 17:05:17 -0500 From: Raul Miller <[email protected]> To: Programming forum <[email protected]> Subject: Re: [Jprogramming] derivatives of a gerund Message-ID: <CAD2jOU9ia2eJdbJzvhfE1p=9zudbgnaq5elk0zvnx20biwe...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Like this? dgerund=:3 :0"0 {.(y`:6 d.1)`'' ) r=:4 :0 dx=. dgerund x ddx=. dgerund dx NB. fill in the rest... ) Note that if you have verbs which can't be handled by d. you'll have to use a cover for d.1 which does what you need for those cases. Thanks, -- Raul On Tue, Nov 3, 2015 at 4:43 PM, David Lambert <[email protected]> wrote:
>In algebraic notation I have a parametric curve
>x=u(t), y=v(t), z=v(t)
>and need radius_of_curvature(t)
>
>Would like the verb r taking a gerund argument,
>u`v`w r t
>but requires first and second derivatives.
>
>In LaTeX linear notation, with \times representing cross product, curvature
>is
>\[\frac{\|\vec{r'}\|^3}{\|\vec{r'}\times\vec{r''}\|}\]
>
>This being messy, derivatives of a gerund packed back into a gerund would be
>great, then `:0 would generate the vectors.
>
>Thanks, Dave.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to