最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
几个 数值分析 的算法例子
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
<%@ 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
相关文章
- 微软新版Surface Laptop预售 你会充值信仰吗 07-31
- 阴阳师神龛金御札兑换随机SSR 阴阳师金御札值不值得换 07-31
- 火影忍者手游泳装雏田好吗 值得买吗 07-10
- 一加5对比努比亚Z17 谁是高颜值超长续航战斗机 07-06
- 英雄无敌罗伊德技能实力分析 罗伊德值得培养吗 07-06
- WPS表格添加筛选唯一值功能教程 07-04