Application: latex picture environment qbezier
require'~addons/math/calculus/calculus.ijs'
qbezier_slope=: (*:@:-.deriv 1) , (+:@:(*-.)deriv 1) ,: *:deriv
1
Naturally I'd like to ask for the first derivative only once.
What please is a shorthand? Suggest we extend the calculus
addon to handle separators , ` ,: ,. ; ?
Thanks, Dave
context:
NB. quadratic bezier splines
g=: *:@:-. , +:@:(* -.) ,: *: NB. g computes parametric
weights
a=:(*:@:-.)`(+:@:(*-.))`*:`:0 NB. alternative
r=:i.%<: NB. evaluation domain [0 1]
g r 4x
1 4r9 1r9 0
0 4r9 4r9 0
0 1r9 4r9 1
Note'Use:'
corresponding to latex command \qbezier(x1,
y1)(x, y)(x2, y2)
with control points x1 x x2 ,: y1 y y2
density an integer > 1
require'plot'
plot ;/ points (+/ . * ([: a r)) density NB. draw the
spline
)