File:Ispline order3.svg
From formulasearchengine
Jump to navigation
Jump to search
![File:Ispline order3.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/Ispline_order3.svg/720px-Ispline_order3.svg.png)
Size of this PNG preview of this SVG file: 720 × 540 pixels. Other resolutions: 320 × 240 pixels | 640 × 480 pixels | 1,024 × 768 pixels | 1,280 × 960 pixels | 2,560 × 1,920 pixels.
Original file (SVG file, nominally 720 × 540 pixels, file size: 43 KB)
This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.
Summary
DescriptionIspline order3.svg |
English: Plot showing I-splines of order 3. |
Date | |
Source | Own work |
Author | Skbkekas |
SVG development InfoField | ![]() This plot was created with Matplotlib. |
Source code InfoField | Python codefrom __future__ import division
import numpy as np
import matplotlib.pyplot as plt
def mspline(x, k, i, T):
"""Evaluate the kth order m-spline at x.
Arguments:
----------
x : the point at which the spline is evaluated
k : the order of the spline (k>=1)
i : the interval on which the spline is defined (i<len(T)-k)
T : the knots
Returns:
--------
The value of the spline at x
Note: Use mspline_knots(...) to create T.
"""
if x<T[i]: return 0.
if x>=T[i+k]: return 0.
if k==1: return 1/(T[i+1]-T[i])
d1 = x-T[i]
d2 = T[i+k]-x
v = d1*mspline(x, k-1, i, T) + d2*mspline(x, k-1, i+1, T)
v *= k
v /= (k-1)*(T[i+k]-T[i])
return v
def ispline(x, k, i, T):
"""Evaluate the kth order i-spline at x.
Arguments:
----------
x : the point at which the spline is evaluated
k : the order of the spline
i : the interval on which the spline is defined (i<len(T)-k-1)
T : the knots
Returns:
--------
The value of the spline at x
Note: Use ispline_knots(...) to create T.
"""
j = np.flatnonzero(T<=x)[-1]
if j<i: return 0.
if j-k+1>i: return 1.
v = 0.
for m in range(i,j+1):
v += mspline(x, k+1, m, T)*(T[m+k+1]-T[m])/(k+1)
return v
def mspline_knots(xmin, xmax, k, m):
"""Create an order list of points in the inteval (xmin,xmax)
suitable for use as knots in m-splines and i-splines.
Arguments:
----------
xmin : the lower bound of the interval
xmax : the upper bount of the interval
k : the order of the m-spline for which the knots will be used
m : the number of intervals into which (xmin,xmax) will be partitioned
"""
T = [xmin]*(k-1)
h = (xmax-xmin)/m
T.extend(np.arange(xmin, xmax, h))
T.extend([xmax]*k)
return T
def ispline_knots(xmin, xmax, k, m):
"""Create an order list of points in the inteval (xmin,xmax)
suitable for use as knots in m-splines and i-splines.
Arguments:
----------
xmin : the lower bound of the interval
xmax : the upper bount of the interval
k : the order of the m-spline for which the knots will be used
m : the number of intervals into which (xmin,xmax) will be partitioned
"""
return mspline_knots(xmin, xmax, k+1, m)
def test_ispline():
plt.clf()
plt.axes([0.1,0.1,0.7,0.8])
k = 3
T = ispline_knots(0, 1, k, 5)
A = []
for i in range(1,len(T)-k-1):
F = []
for x in np.arange(0,1.01,0.01):
F.append([x,ispline(x, k, i, T)])
F = np.array(F)
a = plt.plot(F[:,0], F[:,1], '-')
A.append(a)
if i==0: print F
plt.hold(True)
b = plt.figlegend(A, ("i=1", "i=2", "i=3", "i=4", "i=5", "i=6", "i=7"),\
'center right')
b.draw_frame(False)
plt.xlabel(r"$x$")
plt.ylabel(r"$M_i(x
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![w:en:Creative Commons](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![attribution](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
![share alike](https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Cc-sa_white.svg/24px-Cc-sa_white.svg.png)
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Captions
Add a one-line explanation of what this file represents
Items portrayed in this file
depicts
6 June 2009
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 00:53, 7 June 2009 | ![]() | 720 × 540 (43 KB) | wikimediacommons>Skbkekas | {{Information |Description={{en|1=Plot showing I-splines of order 3.}} |Source=Own work by uploader |Author=Skbkekas |Date=2009-06-06 |Permission= |other_versions= }} <!--{{ImageUpload|full}}--> |
File usage
There are no pages that use this file.
Retrieved from "https://en.formulasearchengine.com/wiki/File:Ispline_order3.svg"