• 2021-04-14
    用以下公式求 f(x) 的值。当通项的绝对值小于 10^-7 时停止计算, x 的值由键盘输入。 f(x)=a 1 x^1-a 2 x^2+a 3 x^3-...+(-1) ^(n+1)*a n x^n+...,|X|<1 其中 a 1 =1 , a 2 =2 , a n =1/(a n-2 +a n-1 ) ,n=1,2,3,4,5,... Option Explicit Private Sub Commandl_Click() Dim x As Single , fx As Single Dim a As Single,a1 As Single,a2 As Single Dim t As Single a1=l : a2=2 x=text1 If ___________ Then MsgBox("x 必须在 -1---1 之间 ") ExitSub End If fx=a 1 *x-a 2 *x*x t=(-1)*x*x Do a=1/(a l +a 2 ) t=(-1)*x*x fx= __________ a l =a 2 Loop Until Abs(a*t)<0.0000001 Text2=fx End Sub
  • 举一反三