如何实现4次曲线y=ax^4+bx^3+cx^2+dx+e的平移,绕点(x1,y1)旋转?
请提供方法或源码
Option Explicit Const a = 1 Const b = 1 Const c = 1 Const d = 1 Const e = 1 Dim Result() As String Dim iCount As Long Private Sub Command1_Click() Dim i As Long, Temp() As String Text1.Text = Val(Text1.Text) For i = 0 To UBound(Result) Temp = Split(Result(i), ",") If UNound(Temp) = 1 Then Temp(0) = CStr(CLng(Temp(0)) + CLng(Text1.Text)) Result(i) = Temp(0) & "," & Temp(1) End If Erase Temp Next i End Sub Private Sub Form_Initialize() iCount = 0: ReDim Result(iCount) End Sub Private Sub Form_Load() Call AAA End Sub Private Sub AAA() Dim x As Double, y As Double iCount = 0: ReDim Result(iCount) For x = -100 To 100 ReDim Preserve Result(iCount) y = (((a * x) ^ 4) + ((b * x) ^ 3) + ((c * x) ^ 2) + (d * x) + e) Result(iCount) = x & "," & y iCount = iCount + 1 Next x End Sub
Option Explicit Dim Conster() As Double, Result() As String, Result1() As String, Result2() As String Dim a As Double, b As Double, c As Double, d As Double, e As Double Dim x As Double, y As Double Private Sub Form_Initialize() a = 0: b = 0: c = 0: d = 0: e = 0 ReDim Conster(0): ReDim Result(0): ReDim Result1(0): ReDim Result2(0) End Sub Private Sub Form_Load() Dim i As Long, j As Long, k As Long, m As Long 'y = ax^4+bx^3+cx^2+dx+e 'Sample Function Do While i < 5 '依序输入a,b,c,d,e的值~~若输入错误则该项会一直跳出~直到正确输入为止~ a = Val(InputBox("", "第 " & i + 1 & " 個字")) If a <> 0 Then ReDim Preserve Conster(i) Conster(i) = a i = i + 1 End If Loop If UBound(Conster) = 4 And Conster(4) = Conster(0) * Conster(1) * Conster(2) * Conster(3) Then '若输入值总数 = 5个~或第5个数字无法被前4个数整除~则跳出Sub~表示此方程式无法做正常的因式分解~ a = Conster(0) '通过验证后开始赋值~ b = Conster(1) c = Conster(2) d = Conster(3) e = Conster(4) i = 0: j = 2: k=0: ReDim Conster(0) For y = -5 To 5 Step 1 '-5 ~ 5 之間求Ÿ值各公因数(数值可依需求调整~CPU不够力~当然就别搞太大~会死机) Do While y = 0 If y Mod j = 0 Then y = y / j ReDim Preserve Conster(i) Conster(i) = j i = i + 1 Else j = j + 1 End If Loop if Ubound(Conster)<3 then ReDim Conster(0) '若Ÿ值公因数总数少于4个~则为非正常可分解之4次方程式模式~于此跳过重计~ else if Ubound(Conster)=3 then for m=0 to Ubound(Conster) Result1(m) = x & "," & y next m else for m=0 to UBound(Conster) Result2(m)=x & "," & y next m endif endif next y Else MsgBox "不是標準函式~無法做因式分解求值~" Exit Sub End If End Sub