最新下载
热门教程
- 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
相关文章
- 以下哪种非遗技艺是用针在纸上绣画 蚂蚁新村11月21日答案 11-22
- 江南百景图听风塔怎么样 11-22
- 原神恰斯卡圣遗物怎么搭配 11-22
- 2024年霸王茶姬11月22日口令是什么 2024.11.22霸王茶姬口令介绍 11-22
- 光遇11.21季节蜡烛在哪里 光遇11月21日季节蜡烛位置攻略 11-22
- 光遇11.21大蜡烛在哪里 光遇11月21日大蜡烛位置攻略 11-22