1. <i id='osSvs'><tr id='osSvs'><dt id='osSvs'><q id='osSvs'><span id='osSvs'><b id='osSvs'><form id='osSvs'><ins id='osSvs'></ins><ul id='osSvs'></ul><sub id='osSvs'></sub></form><legend id='osSvs'></legend><bdo id='osSvs'><pre id='osSvs'><center id='osSvs'></center></pre></bdo></b><th id='osSvs'></th></span></q></dt></tr></i><div id='osSvs'><tfoot id='osSvs'></tfoot><dl id='osSvs'><fieldset id='osSvs'></fieldset></dl></div>
      • <bdo id='osSvs'></bdo><ul id='osSvs'></ul>

      <small id='osSvs'></small><noframes id='osSvs'>

    2. <legend id='osSvs'><style id='osSvs'><dir id='osSvs'><q id='osSvs'></q></dir></style></legend>
      <tfoot id='osSvs'></tfoot>

      1. 如何在python中生成一个随机定向的高维圆?

        时间:2023-09-11
        <i id='P5FCn'><tr id='P5FCn'><dt id='P5FCn'><q id='P5FCn'><span id='P5FCn'><b id='P5FCn'><form id='P5FCn'><ins id='P5FCn'></ins><ul id='P5FCn'></ul><sub id='P5FCn'></sub></form><legend id='P5FCn'></legend><bdo id='P5FCn'><pre id='P5FCn'><center id='P5FCn'></center></pre></bdo></b><th id='P5FCn'></th></span></q></dt></tr></i><div id='P5FCn'><tfoot id='P5FCn'></tfoot><dl id='P5FCn'><fieldset id='P5FCn'></fieldset></dl></div>

          <tbody id='P5FCn'></tbody>

          <small id='P5FCn'></small><noframes id='P5FCn'>

          <legend id='P5FCn'><style id='P5FCn'><dir id='P5FCn'><q id='P5FCn'></q></dir></style></legend>
            • <tfoot id='P5FCn'></tfoot>

                • <bdo id='P5FCn'></bdo><ul id='P5FCn'></ul>
                  本文介绍了如何在python中生成一个随机定向的高维圆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想在 R^n 中生成一个随机定向的圆.我已经能够成功地在 n 球的表面上生成点.我读到你可以将它与平面相交并得到一个圆,但我不知道如何在 Python 中做到这一点.

                  I want to generate a randomly oriented circle in R^n. I have been able to successfully generate points on the surface of an n-sphere. I read that you can intersect it with a plane and get a circle, but I don't know how to do this in Python.

                  或者有没有其他方法可以在 Python 中生成它?

                  Or is there any other way to generate it in Python?

                  谢谢!

                  推荐答案

                  既然你已经知道如何在一个n-球面上生成一个随机点,那么只要生成两个这样的点,就叫它们P1P2.这些将确定圆所在的平面.

                  Since you already know how to generate a random point on the surface of an n-sphere, just generate two such points, call them P1 and P2. These will determine the plane in which the circle will lie.

                  我假设这两个点与原点的距离都是 1(如果您选择 1 作为 n 球体的半径,这将是真的).如果不是,则将每个点除以其长度.

                  I am assuming that both these points are a distance of 1 from the origin, (which will be true if you picked 1 as the radius of your n-sphere). If not, divide each point by its length.

                  现在我们想让 P2 垂直于 P1.这可以通过

                  Now we want to make P2 perpendicular to P1. This can be done by

                  P2 = P2 - dot(P1, P2) P1
                  P2 = P2 / || P2 ||
                  

                  然后对于每个点,您可以生成 0 到 2pi 之间的随机角度.通过以下方式将此角度转换为圆上的一个点:

                  Then for each point, you can generate a random angle between 0 and 2pi. Convert this angle to a point on the circle by:

                  cos(angle) * P1 + sin(angle) * P2.
                  

                  这篇关于如何在python中生成一个随机定向的高维圆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                    <tbody id='etUSe'></tbody>

                • <small id='etUSe'></small><noframes id='etUSe'>

                  <i id='etUSe'><tr id='etUSe'><dt id='etUSe'><q id='etUSe'><span id='etUSe'><b id='etUSe'><form id='etUSe'><ins id='etUSe'></ins><ul id='etUSe'></ul><sub id='etUSe'></sub></form><legend id='etUSe'></legend><bdo id='etUSe'><pre id='etUSe'><center id='etUSe'></center></pre></bdo></b><th id='etUSe'></th></span></q></dt></tr></i><div id='etUSe'><tfoot id='etUSe'></tfoot><dl id='etUSe'><fieldset id='etUSe'></fieldset></dl></div>

                      • <bdo id='etUSe'></bdo><ul id='etUSe'></ul>
                        <legend id='etUSe'><style id='etUSe'><dir id='etUSe'><q id='etUSe'></q></dir></style></legend>
                        • <tfoot id='etUSe'></tfoot>