最新下载
热门教程
- 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
相关文章
- Metaplanet最新购入1,112枚比特币后总持仓突破1万枚大关 06-16
- 《艾塔纪元》奥莉维亚凯撒怎么样 06-16
- 安全可靠2025全球交易所虚拟币交易前十-最方便数字资产交易所币安推荐 06-16
- 《超能力冲刺》水风阵容怎么配队 06-16
- 《晶核》平民职业选择推荐细节解读 06-16
- 2025盘点正规币圈十大比特币交易平台TOP10-去中心化加密货币交易所币安app推荐 06-16