博客的第一篇文章

这是一篇测试文章。

1213

from sympy import *
from math import radians, pi
import random
import numpy as np
import matplotlib.pyplot as plt

r = 100
n = 2
position = [i * 40 for i in range(2)]
rou = []
theta = []
i = 0
k = 0
for thetaj_index in range(len(position)):
    thetaj = radians(position[thetaj_index])
    for thetai_index in range(len(position)):
        thetai = radians(position[thetai_index])
        i += 1
        print('外面', i)
        if thetai >= thetaj:  # 此处要求了thetaj要大于thetai
            continue
        for alpha0jd in range(10, 90, 10):
            for alpha0id in range(10, 90, 10):
                # alpha0j = radians(alpha0jd)
                # alpha0i = radians(alpha0id)
                deltatheta = 0.001
                alpha0j= radians(30) + random.uniform(-deltatheta,deltatheta)
                alpha0i= radians(10) + random.uniform(-deltatheta,deltatheta)
                b = sin(alpha0j - thetaj) * sin(alpha0i) - sin(alpha0i - thetai) * sin(alpha0j)
                a = cos(alpha0i - thetai) * sin(alpha0j) - cos(alpha0j - thetaj) * sin(alpha0i)
                if a == 0:
                    continue
                thetak = pi + atan(b / a)
                k += 1
                print('里面', k)
                if thetak <= thetaj and ((thetak - thetai) > pi or (thetak - thetaj) > pi):
                    continue  # 限制thetak必须要大于thetaj
                theta.append(thetak * (180 / pi))
                rouk = r * sin(thetak + alpha0i - thetai) / sin(alpha0i)
                rou.append(rouk)
                print('thetai',(180 / pi) * thetai,'thetaj', (180 / pi) * thetaj, 'alpha0i',(180 / pi) * alpha0i,'alpha0j', (180 / pi) * alpha0j,
                      'rouk',(180 / pi) * rouk,'thetak', (180 / pi) * thetak)
solver = []
solvet = []
theta_circle = np.linspace(0, 2 * np.pi, 1000)
r = 100  # 圆形半径
x = r * np.cos(theta_circle)
y = r * np.sin(theta_circle)
plt.plot(x, y, color='black')
for i in range(len(rou)):
    print(rou[i], theta[i])
    solver.append(rou[i] * cos(theta[i]))
    solvet.append(rou[i] * sin(theta[i]))
plt.scatter(solver, solvet, s=70,color='red',label='计算值')
plt.axis('equal')
roustandard = [100 for _ in range(9)]
thetastandard = [radians(40*k) for k in range(9)]
plt.scatter(0,0,color='blue',s=100)
for i in range(len(roustandard)):
    if i ==0 or i==1:
        plt.scatter(roustandard[i] * cos(thetastandard[i]), roustandard[i] * sin(thetastandard[i]), color='blue', s=100,
                    label='标准值')
        plt.text(roustandard[i] * cos(thetastandard[i])+10, roustandard[i] * sin(thetastandard[i]),i+1,fontsize = 10)
        continue
    elif i == 4:
        plt.scatter(roustandard[i] * cos(thetastandard[i]), roustandard[i] * sin(thetastandard[i]), color='green', s=100,
                    label='标准值')
        plt.text(roustandard[i] * cos(thetastandard[i]) + 10, roustandard[i] * sin(thetastandard[i]), i + 1, fontsize=10)
        continue
    plt.scatter(roustandard[i]*cos(thetastandard[i]),roustandard[i]*sin(thetastandard[i]),color='black',s=100,label='标准值')
    plt.text(roustandard[i] * cos(thetastandard[i]) + 10, roustandard[i] * sin(thetastandard[i]), i + 1, fontsize=10)
plt.text(5,5,0, fontsize=10)
plt.savefig('pic1.jpg',dpi=300)
plt.show()

评论

  1. 1 年前
    2023-10-01 20:25:22

    您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar

  2. example user
    Windows Edge
    1 年前
    2023-10-02 23:46:47

    这是一条测试评论

  3. 博主
    Android Chrome
    1 年前
    2023-10-05 4:17:42

    2

  4. KeChang
    Macintosh Safari
    1 年前
    2023-10-07 10:14:09

    Test

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
下一篇

      友情链接:   KeChang