Algorithm <%@ Language=vbscript%>
<%
' The data for several reference points have been given, and the input parameters are only X
function view (RESULT,INPUTX) ' Outputs the result, and if <1 and >0, make up 0 in front
If Result<1 and result>0 then Result=0&result
Response.Write "Calculation result:" & "<br>"
Response.Write "F" ("&inputx&") = "& Result
End Function
' ******** piecewise linear lagrange interpolation **********
function Lagrange1 (INPUTX)
Dim k,i
Dim x,y
X=array ("0.1", "0.2", "0.3", "0.4")
Y=array ("0.0998", "0.1987", "0.2955", "0.3894")
If Inputx<x (0) then k=0
If Inputx>x (3) then k=2
For I=0 to 2
If Inputx>=x (i) and inputx<=x (i+1) then k=i
Result= ((Inputx-x (k+1))/(x (k)-X (k+1)) *y (k) + ((Inputx-x (k))/(x (K+1)-X (k)) *y (k+1)
Next
result= View (RESULT,INPUTX)
End Function?
' ******** piecewise 3.2 Lagrange interpolation **********
function Lagrange2 (INPUTX)
Dim i,j,k,t
Dim x,y
Result=0
X=array ("0.1", "0.2", "0.3", "0.4")
Y=array ("0.0998", "0.1987", "0.2955", "0.3894")
If Inputx<=x (1) then k=0
If Inputx>=x (2) then k=1
If Inputx>x (1) and inputx<x (2) and ABS (Inputx-x (1)) <=abs (Inputx-x (2)) then k=0 else k=1
For J=k to K+2
T=1
For i= K to K+2
If I<>j Then
t= T * (Inputx-x (i))/(X (j)-X (i))
End If
Next
result = result + T*y (j)
Next
result= View (RESULT,INPUTX)
End Function
' ********** N-point Lagrangian interpolation ***********
function Lagrange3 (INPUTX)
Dim i,j
Dim x,y
Result=0
X=array ("0", "0.1", "0.195", "0.4", "0.401", "0.5")
Y=array ("0.39894", "0.39695", "0.39142", "0.38138", "0.36812", "0.35206")
For J=0 to 5
T=1
For I=0 to 5
If I<>j Then
t= T * (Inputx-x (i))/(X (j)-X (i))
End If
Next
result = result + T * Y (j)
Next
result= View (RESULT,INPUTX)
End Function
' *********** Newton (Newton) interpolation ***********
function Newton (INPUTX)
Dim x,y
Dim i,j
result=0.39894
T=1
X=array ("0", "0.1", "0.195", "0.3", "0.401", "0.5")
Y=array ("0.39894", "0.39695", "0.39142", "0.38138", "0.36812", "0.35206")
For J=1 to 5
t=t* (Inputx-x (j-1))
For I=0 to 5-j
Y (i) = (Y (i+1)-y (i))/(x (I+J)-X (i))
Next
result = result + T * Y (0)
Next
result= View (RESULT,INPUTX)
End Function
' *********** Aitken (Aitken) interpolation ***********
function Aitken (INPUTX)
Dim i,j
Dim x,y
X=array ("0.5", "0.65", "0.8", "1.0")
Y=array ("0.4794", "0.6052", "0.7174", "0.8415")
For J=1 to 3
For I=j to 3
Y (i) =y (j-1) + (Y (i)-y (j-1))/(X (i)-X (j-1)) * (Inputx-x (j-1))
Next
Next
result= View (Y (3), INPUTX)
End Function
' *********** 2.3-Time (Ernie) (hermit) interpolation ***********
function Hermit (INPUTX)
Dim i,k
Dim x,y,yy
X=array ("0.1", "0.3", "0.5")
Y=array ("0.099833", "0.295520", "0.479426")
Yy=array ("0.995004", "0.995336", "0.877583")
If Inputx<=x (0) then k=0
If Inputx>=x (2) then k=1
For i=0 to 1
If x (i) <=inputx and Inputx<=x (i+1) then k=i
Next
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.