|
发表于 2010-6-8 17:53:09
|
显示全部楼层
inv(x)=tan(x)-x
) \# |; S3 @& k4 {5 J4 x逆函數可以 用表查 , 或是用牛頓法
4 b8 @/ V. T" v1 {
[ _, r6 F6 }[vb6/vba] Office excel also with this moudle % n4 _2 S5 c* h+ v8 z) |6 T2 q
Public Function Inverse_inv(value As Variant)
% }4 h% {: Z! u- @ Dim ape As Double
2 }: O& B: v7 Z Dim pe0 As Double
" f# B/ Z6 z( Y9 |8 J4 }2 n Dim pe1 As Double
$ H6 K$ b! N2 _6 |4 A. S' N ape = (3 * value) ^ (1 / 3)
% b8 ?4 Q6 M7 b' c, p- u Do; T$ S; Z7 V0 {& X0 O$ Q$ O0 ~
If ape >= 1000000000# Then ape = PI / 2: Exit Do+ G- @+ Z. H/ `5 C
pe0 = ape
+ \' Y6 Q3 w( j% e; r E# K4 Z pe1 = ape + (value + ape - Tan(ape)) / (Tan(ape) ^ 2)
, K* @# D' g9 j: @! H ape = pe15 ^5 B+ H$ k) ^: P$ M8 G$ H. l
Loop Until Abs(pe1 - pe0) <= 0.0000001
5 o1 i; V* P% J6 h3 H) k& `9 i Inverse_inv = ape
% b6 {9 \2 `1 C* l2 }End Function |
|