MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105685] Re: [mg105655] question
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 15 Dec 2009 07:27:40 -0500 (EST)
  • References: <200912140505.AAA16909@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

data = A;
fn = BSplineFunction[data, SplineDegree -> 3];

Here's the data and the spline:

Show[Graphics[{Red, Point[data], Green, Line[data]}, Axes -> True],
  ParametricPlot[fn[t], {t, 0, 1}], AspectRatio -> .25]

and here, I believe, is the derivative:

Plot[Divide @@ Reverse[fn'[t]], {t, 0, 1}, AspectRatio -> .5,
  PlotRange -> All]

That's a function of t, not x, and maybe that's what you want. (Or maybe  
fn'[t] is all you need. It's up to you.)

To get y'[x], we first need t as a function of x. The smaller you make  
"mesh", the more accurate this will be (I think):

mesh = .0001;
tAtX = Interpolation@Table[{First@fn[t], t}, {t, 0, 1, mesh}];
limits = Sequence @@ data[[{1, -1}, 1]];
Plot[tAtX@x, Evaluate@{x, limits}, PlotRange -> All]

and finally:

fnD[x_] := Divide @@ Reverse[fn'[tAtX@x]]
Plot[fnD@x, Evaluate@{x, limits}]

Bobby

On Sun, 13 Dec 2009 23:05:21 -0600, Piotr Munik <piotr.munik at gmail.com>  
wrote:

> I have a problem with BSpline Function.
> I want to know how can I make derivative of BSplineFunction.
> Example
> I have date:
> A = {{35460.`, 3679.0872`}, {35460.69264747737`,
>   3687.7503846982163`}, {35461.28773994215`,
>   3692.3961023958045`}, {35461.806871210974`,
>   3694.2412898524603`}, {35462.26724874828`,
>   3694.153846663659`}, {35462.68278354234`,
>   3692.751661338148`}, {35463.064844684086`,
>   3690.4735944025206`}, {35463.42275907352`,
>   3687.6306750451413`}, {35463.764140416955`,
>   3684.443207780651`}, {35464.09511694083`,
>   3681.06769769011`}, {35464.42050735041`,
>   3677.616304426622`}, {35464.74397598101`,
>   3674.1707494759285`}, {35465.06818332038`,
>   3670.7920866860404`}, {35465.39493765232`,
>   3667.5274013715157`}, {35465.725347137995`,
>   3664.414261219639`}, {35466.05996825088`,
>   3661.483561387575`}, {35466.3989453914`,
>   3658.761262965816`}, {35466.74213684692`,
>   3656.2694059318`}, {35467.089223399555`,
>   3654.026678876124`}, {35467.43979743582`,
>   3652.0487455457387`}, {35467.793431899845`,
>   3650.3484613388064`}, {35468.149729802935`,
>   3648.936060393955`}, {35468.508356050195`,
>   3647.8193546780835`}, {35468.86905403582`,
>   3647.003958999106`}, {35469.231649893`,
>   3646.493538377201`}, {35469.59604735504`,
>   3646.2900647088964`}, {35469.962216097105`,
>   3646.3940662134573`}, {35470.33017615164`,
>   3646.8048539002734`}, {35470.699980580255`,
>   3647.5207126272817`}, {35471.071698196596`,
>   3648.5390489346887`}, {35471.44539764735`,
>   3649.8564926946046`}, {35471.8211337682`,
>   3651.468954045882`}, {35472.19893675605`,
>   3653.3716406325216`}, {35472.57880436523`,
>   3655.5590426339295`}, {35472.96069710453`,
>   3658.024894452097`}, {35473.34453622771`,
>   3660.7621222927396`}, {35473.73020415663`,
>   3663.7627864213086`}, {35474.11754694328`,
>   3667.018025827071`}, {35474.506378305014`,
>   3670.51801158167`}, {35474.89648479548`,
>   3674.251913569262`}, {35475.2876317024`,
>   3678.2078836490937`}, {35475.67956928002`,
>   3682.3730568207175`}, {35476.07203902216`,
>   3686.7335707090747`}, {35476.46477969639`,
>   3691.274602688824`}, {35476.857532946524`,
>   3695.9804232725514`}, {35477.25004832435`,
>   3700.834463961712`}, {35477.64208764039`,
>   3705.8193975690688`}, {35478.03342858835`,
>   3710.9172290329852`}, {35478.42386763393`,
>   3716.1093948886532`}, {35478.81322216143`,
>   3721.3768697843334`}, {35479.201331936965`, 3726.7002787009123`}};
> and I have a BSplineFunction:
> In[1] fn = BSplineFunction[A, SplineDegree -> 3]
> Out[1] BSplineFunction[{{0.,1.}},<>]
> I need derivative of function from Out[1]
> Thank You
> Piotr
>
>


-- 
DrMajorBob at yahoo.com


  • References:
    • question
      • From: Piotr Munik <piotr.munik@gmail.com>
  • Prev by Date: Re: question
  • Next by Date: Re: Re: Compute once question
  • Previous by thread: question
  • Next by thread: Re: question