最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
几个 数值分析 的算法例子
时间:2022-06-30 11:21:35 编辑:袖梨 来源:一聚教程网
<%@ Language=VBScript %>
<%
'几个参考点的数据已经给出,输入参数只有 X
function view(result,inputx) '输出结果,同时如果<1 and >0,就在前面补0
if result<1 and result>0 then result=0&result
Response.Write "计算结果:"&"
"
Response.Write "F("&inputx&")="& result
end function
'********分段线性Lagrange插值**********
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 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
'********分段三点二次Lagrange插值**********
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 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
<%
'几个参考点的数据已经给出,输入参数只有 X
function view(result,inputx) '输出结果,同时如果<1 and >0,就在前面补0
if result<1 and result>0 then result=0&result
Response.Write "计算结果:"&"
"
Response.Write "F("&inputx&")="& result
end function
'********分段线性Lagrange插值**********
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
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
'********分段三点二次Lagrange插值**********
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
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
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20