ASP网页编程之几个数值剖析的算法则子
asp,你就只能等着微软给你解决,它不乐意你就只好悲催。而且asp跑在windows服务器上,windows服务器跟linux比起来简直弱爆了!算法<%@Language=VBScript%><%
几个参考点的数据已给出,输出参数只要X
functionview(result,inputx)输入了局,同时假如<1and>0,就在后面补0
ifresult<1andresult>0thenresult=0&result
Response.Write"盘算了局:"&"<br>"
Response.Write"F("&inputx&")="&result
endfunction
********分段线性Lagrange插值**********
functionLagrange1(inputx)
dimk,i
dimx,y
x=array("0.1","0.2","0.3","0.4")
y=array("0.0998","0.1987","0.2955","0.3894")
ifinputx<x(0)thenk=0
ifinputx>x(3)thenk=2
fori=0to2
ifinputx>=x(i)andinputx<=x(i+1)thenk=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)
endfunction?
********分段三点二次Lagrange插值**********
functionLagrange2(inputx)
dimi,j,k,t
dimx,y
result=0
x=array("0.1","0.2","0.3","0.4")
y=array("0.0998","0.1987","0.2955","0.3894")
ifinputx<=x(1)thenk=0
ifinputx>=x(2)thenk=1
ifinputx>x(1)andinputx<x(2)andabs(inputx-x(1))<=abs(inputx-x(2))thenk=0elsek=1
forj=ktok+2
t=1
fori=ktok+2
ifijthen
t=t*(inputx-x(i))/(x(j)-x(i))
endif
next
result=result+t*y(j)
next
result=view(result,inputx)
endfunction
**********一元n点拉格朗日插值***********
functionLagrange3(inputx)
dimi,j
dimx,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")
forj=0to5
t=1
fori=0to5
ifijthen
t=t*(inputx-x(i))/(x(j)-x(i))
endif
next
result=result+t*y(j)
next
result=view(result,inputx)
endfunction
***********牛顿(Newton)插值***********
functionNewton(inputx)
dimx,y
dimi,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")
forj=1to5
t=t*(inputx-x(j-1))
fori=0to5-j
y(i)=(y(i+1)-y(i))/(x(i+j)-x(i))
next
result=result+t*y(0)
next
result=view(result,inputx)
endfunction
***********埃特金(Aitken)插值***********
functionAitken(inputx)
dimi,j
dimx,y
x=array("0.5","0.65","0.8","1.0")
y=array("0.4794","0.6052","0.7174","0.8415")
forj=1to3
fori=jto3
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)
endfunction
***********分段两点三次埃(厄)尔米特(Hermit)插值***********
functionHermit(inputx)
dimi,k
dimx,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")
ifinputx<=x(0)thenk=0
ifinputx>=x(2)thenk=1
fori=0to1
ifx(i)<=inputxandinputx<=x(i+1)thenk=i
next
hx1=(1+2*(inputx-x(k))/(x(k+1)-x(k)))*mul((x(k+1)-inputx)/(x(k+1)-x(k)))
hx2=(1+2*(x(k+1)-inputx)/(x(k+1)-x(k)))*mul((inputx-x(k))/(x(k+1)-x(k)))
hx3=(inputx-x(k))*mul((x(k+1)-inputx)/(x(k+1)-x(k)))
hx4=(inputx-x(k+1))*mul((inputx-x(k))/(x(k+1)-x(k)))
result=y(k)*hx1+y(k+1)*hx2+yy(k)*hx3+yy(k+1)*hx4
result=view(result,inputx)
endfunction
functionmul(str)
mul=str*str
endfunction
%>
ASP最大的缺点在于网络的安全性和可靠性,企业将经营数据放在开放的平台上,最大的担忧就是如何保证这些数据不被其他人破坏。 Response:从字面上讲是“响应”,因此这个是服务端向客户端发送东西的,例如Response.Write Session:这个存储跟客户端会话过程的数据,默认20分钟失效 Request:从字面上讲就是“请求”,因此这个是处理客户端提交的东东的,例如Resuest.Form,Request.QueryString,或者干脆Request("变量名") 我就感觉到ASP和一些常用的数据库编程以及软件工程方面的思想是非常重要的。我现在也在尝试自己做网页,这其中就用到了ASP,我想它的作用是可想而知的。 Session:这个存储跟客户端会话过程的数据,默认20分钟失效 他的语法和设计思路和VB完全相同,导致很多ASP的书都留一句“相关内容请参考VB的相关教材....”更糟糕的是,相当多的ASP教程混合了Javascript,VBscript等等脚本语言,搞的初学者。 跟学别的语言一样,先掌握变量,流程控制语句(就是ifwhileselect)等,函数/过程,数组 ASP.Net和ASP的最大区别在于编程思维的转换,而不仅仅在于功能的增强。ASP使用VBS/JS这样的脚本语言混合html来编程,而那些脚本语言属于弱类型、面向结构的编程语言,而非面向对象,这就明显产生以下几个问题:
页:
[1]