Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'bsplinefunction' topicStudent Support Forum > General > "bsplinefunction"

Next Comment >Help | Reply To Topic
Author Comment/Response
sam
06/22/12 04:23am

Hi,

I want to calculate the curvature on each point of a series of datapoints. Here I want to use a bsplinefunction and the formula

k = x'y''-y'x''/(x'2+y'2)^3/2

My question is:
Is it possible to explain me:
- whether the derivatives of a bsplinefunction are parametric
- what does the outcome of the first and especially the second derivate means
- whether there is another way to calculate the curvature of the curve fitted through the datapoint: for example since a bspline function is continuous to set up a continuous function for curvature.

I would really appreciate your help!

Thanks in advance

Kind Regards,

Sam

Below you can find the data and other inputs I have used:
-----------------------------------------------------
I extracted datapoints of Sin[x] and fitted a curve through it with bsplinefunction. Then I've calculated the first and second derivative:

data= {{0., 0.159155, 0.31831, 0.477465, 0.63662, 0.795775, 0.95493, 1.11408, 1.27324, 1.43239, 1.59155, 1.7507, 1.90986, 2.06901, 2.22817, 2.38732, 2.54648, 2.70563, 2.86479, 3.02394, 3.1831, 3.34225, 3.50141, 3.66056, 3.81972, 3.97887, 4.13803, 4.29718, 4.45634, 4.61549, 4.77465, 4.9338, 5.09296, 5.25211, 5.41127, 5.57042, 5.72958, 5.88873, 6.04789, 6.20704}}

f=BSplineFunction[data];
df=f';
df2=f''

I plotted f with parametricplot and it is correct as it shows a sinus.

However I do not understand the output of the derivatives. For every datapoint I have calculated the first and second derivative where the output are vectors:

input first derivative:
Table[df[t], {t, 0, 1, 1/Length[data]}]

output first derivative:
{{6.20704, 6.18087}, {6.20704, 5.96667}, {6.20704, 5.62625}, {6.20704,5.16932}, {6.20704, 4.6077}, {6.20704, 3.95506}, {6.20704,3.22662}, {6.20704, 2.43885}, {6.20704, 1.60914}, {6.20704,0.755456}, {6.20704, -0.103985}, {6.20704, -0.951085}, {6.20704,-1.76819}, {6.20704, -2.53841}, {6.20704, -3.24594}, {6.20704,-3.87636}, {6.20704, -4.41687}, {6.20704, -4.85653}, {6.20704,-5.18647}, {6.20704, -5.40003}, {6.20704, -5.49291}, {6.20704,-5.46321}, {6.20704, -5.31149}, {6.20704, -5.04074}, {6.20704, -4.65637}, {6.20704, -4.16605}, {6.20704, -3.57964}, {6.20704, -2.90895}, {6.20704, -2.16759}, {6.20704, -1.37067}, {6.20704, -0.534567}, {6.20704, 0.323397}, {6.20704, 1.18527}, {6.20704,
2.03279}, {6.20704, 2.84775}, {6.20704, 3.61233}, {6.20704,
4.30944}, {6.20704, 4.92306}, {6.20704, 5.43857}, {6.20704,
5.84302}, {6.20704, 6.12547}}

I thought that since f is a parametric function you would get the derivatives: {x',y'}. However since the x component of each vector is the same this doesn't looks like {x',y'}. However when I divide the y component with the x component and plot it with parametric plot It shows the correct first derivative of Sin[x].

When I calculate the second derivative of f for each datapoint:

input:
Table[df[t], {t, 0, 1, 1/Length[data]}]

output:
{{0., -5.93686}, {2.83944*10^-14, -11.1497}, {-2.67432*10^-14, \
-16.0192}, {2.07167*10^-14, -20.4563}, {-1.0331*10^-14, -24.3819}, {-3.18137*10^-15, -27.7277}, {-9.00231*10^-15, -30.4375}, {-1.67109*10^-14, -32.468}, {-3.81165*10^-14, -33.7889}, {-7.13151*10^-15, -34.3839}, {-3.71158*10^-15, -34.2505}, {1.81752*10^-15, -33.3996}, {5.03035*10^-15, -31.8558}, {2.81317*10^-14, -29.6562}, {1.16554*10^-14, -26.8502}, {2.65659*10^-14, -23.4979}, {-1.50181*10^-14, -19.6696}, {2.54491*10^-14, -15.4439}, {-6.20888*10^-14, -10.9067}, {-9.7495*10^-14, -6.14963}, {1.057*10^-14, -1.26804}, {-8.61948*10^-14, 3.64037}, {5.6392*10^-14, 8.47739}, {9.26123*10^-14, 13.1461}, {-1.85182*10^-14, 17.5524}, {2.44579*10^-14, 21.6071}, {-3.89881*10^-14, 25.2271}, {-8.9268*10^-14, 28.3371}, {-1.25941*10^-15, 30.871}, {-3.71925*10^-15, 32.7732}, {2.89491*10^-14, 33.9994}, {1.9329*10^-13, 34.5179}, {-1.51434*10^-13, 34.3099}, {-1.15463*10^-14,33.3703}, {-7.4607*10^-14, 31.7077}, {-8.52651*10^-14, 29.3446}, {2.84217*10^-13, 26.3172}, {2.27374*10^-13, 22.6748}, {0.,18.4792}, {9.09495*10^-13, 13.804}, {-3.63798*10^-12, 8.73321}}

The first components are not the same for all vectors like for the first derivative.



URL: ,

Subject (listing for 'bsplinefunction')
Author Date Posted
bsplinefunction sam 06/22/12 04:23am
Re: bsplinefunction Michael 06/23/12 7:25pm
Next Comment >Help | Reply To Topic