明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3554|回复: 2

[自我挑战] 【自我挑战72】

[复制链接]
发表于 2006-8-22 17:03:00 | 显示全部楼层 |阅读模式

求a值:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2006-8-24 10:04:00 | 显示全部楼层
我把71题的代码,加了一点:
  1. Sub Joseflin_72()
  2.     Dim x0 As Double, x As Double, fx As Double, flx As Double
  3.     Dim A As Double, B As Double, C As Double, D As Double
  4.     Const pi = 3.1415926535897
  5.     x0 = 0.01
  6.     x1 = x0
  7.     Do
  8.         x0 = x1
  9.         A = (1 - 3 * x0 - 2 * x0 * x0) / (1 - 3 * x0 + 2 * x0 * x0)
  10.         B = (1 - 5 * x0 - 6 * x0 * x0) / (1 - 5 * x0 + 6 * x0 * x0)
  11.         C = x0 / (1 - x0)
  12.         D = 3 * x0 / (1 - 3 * x0)
  13.         fx = Atn(Sqr(1 - A * A) / A) + Atn(Sqr(1 - B * B) / B) + _
  14.              Atn(C / Sqr(1 - C * C)) + Atn(D / Sqr(1 - D * D)) - 1
  15.         flx = (-1 / Sqr(1 - A * A)) * (12 * x0 * x0 - 8 * x0) / (1 - 3 * x0 + 2 * x0 * x0) ^ 2 + _
  16.               (-1 / Sqr(1 - B * B)) * (60 * x0 * x0 - 24 * x0) / (1 - 5 * x0 + 6 * x0 * x0) ^ 2 + _
  17.               (1 / Sqr(1 - C * C)) / (1 - x0) ^ 2 + (1 / Sqr(1 - D * D)) * 3 / (1 - 3 * x0) ^ 2
  18.         x1 = x0 - fx / flx
  19.     Loop While Abs(x1 - x0) > 0.0000000000001
  20.    
  21.     x1 = 100 * x1
  22.     Dim L1 As AcadLine, L2 As AcadLine, Arc As AcadArc
  23.     Dim P0(2) As Double, P1 As Variant, P2 As Variant
  24.     P0(0) = 0: P0(1) = 0: P0(2) = 0
  25.     P1 = ThisDrawing.Utility.PolarPoint(P0, 0.5 * pi - 0.5, 100)
  26.     P2 = ThisDrawing.Utility.PolarPoint(P0, 0.5 * pi + 0.5, 100)
  27.     Set L1 = ThisDrawing.ModelSpace.AddLine(P0, P1)
  28.     Set L2 = ThisDrawing.ModelSpace.AddLine(P0, P2)
  29.     Set Arc = ThisDrawing.ModelSpace.AddArc(P0, 100, 0.5 * pi - 0.5, 0.5 * pi + 0.5)
  30.    
  31.     Dim cenPt1 As Variant, ang1 As Double, C1 As AcadCircle
  32.     ang1 = 0.5 * pi + 0.5 - Atn(C / Sqr(1 - C * C))
  33.     cenPt1 = ThisDrawing.Utility.PolarPoint(P0, ang1, 100 - x1)
  34.     Set C1 = ThisDrawing.ModelSpace.AddCircle(cenPt1, x1)
  35.    
  36.     Dim cenPt2 As Variant, ang2 As Double, C2 As AcadCircle
  37.     ang2 = ang1 - Atn(Sqr(1 - A * A) / A)
  38.     cenPt2 = ThisDrawing.Utility.PolarPoint(P0, ang2, 100 - 2 * x1)
  39.     Set C2 = ThisDrawing.ModelSpace.AddCircle(cenPt2, 2 * x1)
  40.    
  41.     Dim cenPt3 As Variant, ang3 As Double, C3 As AcadCircle
  42.     ang3 = 0.5 * pi - 0.5 + Atn(D / Sqr(1 - D * D))
  43.     cenPt3 = ThisDrawing.Utility.PolarPoint(P0, ang3, 100 - 3 * x1)
  44.     Set C3 = ThisDrawing.ModelSpace.AddCircle(cenPt3, 3 * x1)
  45.     ZoomExtents
  46.     MsgBox "小圆半径=" & x1, , "Joseflin_自我挑战72"
  47. End Sub

发表于 2006-9-14 18:04:00 | 显示全部楼层

楼上的强!

佩服!

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-24 01:23 , Processed in 0.183837 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表