{ "info": { "author": "Yunseong Jeong", "author_email": "Yunseong14@naver.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# n_sphere\n\nSpherical Coordinate system, Rectangular coordinate system and Stereographic Projection in N-sphere (Using Python)\n\nhttps://pypi.org/project/n-sphere/\n\n1. Spherical Coordinate ([Show Image](https://wikimedia.org/api/rest_v1/media/math/render/svg/fff301fb5050086e409e13519f82295f23b2987a))\n ```\n r = math.sqrt( (x_n)^2 + ((x_n-1)^2) + ... + (x_1)^2 )\n Phi_1 = math.acos( x_1 / math.sqrt((x_n)^2 + (x_n-1)^2 + ... + (x_1)^2 ))\n Phi_2 = math.acos( x_2 / math.sqrt((x_n)^2 + (x_n-1)^2 + ... + (x_2)^2 ))\n ...\n Phi_n-2 = math.acos( x_n-2 / math.sqrt((x_n)^2 + (x_n-1)^2 ))\n Phi_n-1 = math.acos( x_n-1 / math.sqrt((x_n)^2 + (x_n-1)^2 )) (x_n >= 0)\n = 2 * Pi - math.acos( x_n-1 / math.sqrt((x_n)^2 + (x_n-1)^2 )) (x_n < 0) \n ```\n - R = radius\n - n - 1 angular coordinates Phi_1, Phi_2, ... , Phi_n-1 in n-dimensional Euclidean Space\n - Phi_1 , Phi_2 , ... , Phi_n-2 range over **[0, Pi]** radians\n - Phi_n-1 range over **[0, 2 * Pi)** radians\n2. Rectangular Coordinate ([Show Image](https://wikimedia.org/api/rest_v1/media/math/render/svg/0c4349e9ce260f719ebf573067bc7b84305ae31c))\n ```\n x_1 = r * math.cos(Phi_1)\n x_2 = r * math.sin(Phi_1) * math.cos(Phi_2)\n x_3 = r * math.sin(Phi_1) * math.sin(Phi_2) * math.cos(Phi_3)\n ...\n x_n-1 = r * math.sin(Phi_1) * ... * math.sin(Phi_n-2) * math.cos(Phi_n-1)\n x_n = r * math.sin(Phi_1) * ... * math.sin(Phi_n-2) * math.sin(Phi_n-1)\n ``` \n\n3. Stereographic Projection (**incomplete**)\n - In 3-dimension\n ```\n [x,y,z] -> [x/1-z, y/1-z]\n ```\n - In N-dimension\n ```\n [x_1 , x_2 , ... , x_n] -> [ x_1 / 1-x_n , x_2 / 1-x_n , ... , x_n-1 / 1-x_n] \n ```\n\n4. Generating random points (Plan)\n\n\n# Project Object\nhttps://en.wikipedia.org/wiki/N-sphere\n\n# How to Use\n```\npip install n-sphere\n```\n- Tensor (Using Torch)\n``` shell script\n> python\nPython 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import torch\n>>> import n_sphere\n>>> x = torch.randint(10, size(5,3,))\nTraceback (most recent call last):\n File \"\", line 1, in \nNameError: name 'size' is not defined\n>>> x = torch.randint(10, size=(5,3,))\n>>> x\ntensor([[1, 0, 4],\n [2, 7, 9],\n [1, 8, 6],\n [4, 9, 3],\n [0, 8, 1]])\n>>> c_x = n_sphere.convert_spherical(x)\n>>> c_x\ntensor([[ 4.1231, 1.3258, 1.5708],\n [11.5758, 1.3972, 0.9098],\n [10.0499, 1.4711, 0.6435],\n [10.2956, 1.1718, 0.3218],\n [ 8.0623, 1.5708, 0.1244]], dtype=torch.float64)\n>>> r_x = n_sphere.convert_rectangular(c_x)\n>>> r_x\ntensor([[1.0000e+00, 2.4493e-16, 4.0000e+00],\n [2.0000e+00, 7.0000e+00, 9.0000e+00],\n [1.0000e+00, 8.0000e+00, 6.0000e+00],\n [4.0000e+00, 9.0000e+00, 3.0000e+00],\n [2.6347e-06, 8.0000e+00, 1.0000e+00]], dtype=torch.float64)\n```\n\n- List\n```shell script\n>>> list = [\n... [2,3,4,5,6],\n... [4,1,3,6,7],\n... [2,2,2,2,2],\n... [4,9,1,2,8]]\n>>> c_list = n_sphere.convert_spherical(list)\n>>> c_list\narray([[ 9.48683298, 1.358384 , 1.241372 , 1.097478 , 0.87605805],\n [10.53565375, 1.181364 , 1.468018 , 1.256207 , 0.86217005],\n [ 4.47213595, 1.107149 , 1.047198 , 0.955317 , 0.78539816],\n [12.88409873, 1.255119 , 0.745355 , 1.450118 , 1.32581766]])\n>>> r_list = n_sphere.convert_rectangular(c_list)\n>>> r_list\narray([[2.000001, 3. , 4. , 5. , 6. ],\n [4.000001, 0.999996, 2.999996, 6.000001, 7.000001],\n [1.999999, 1.999999, 2. , 2.000001, 2.000001],\n [4.000002, 9.000003, 0.999998, 1.999999, 7.999996]])\n>>>\n```\n- Number of digits can be changed in Round Function (default = 6)\n\n```sh\n>>> list = [\n... [2,3,4,5,6],\n... [4,1,3,6,7],\n... [2,2,2,2,2],\n... [4,9,1,2,8]]\n>>> c_list = n_sphere.convert_spherical(list,10)\n>>> c_list\narray([[ 9.48683298, 1.35838411, 1.24137205, 1.097478 , 0.87605805],\n [10.53565375, 1.18136412, 1.46801764, 1.25620658, 0.86217005],\n [ 4.47213595, 1.10714872, 1.04719755, 0.95531662, 0.78539816],\n [12.88409873, 1.2551192 , 0.74535537, 1.45011777, 1.32581766]])\n>>> r_list = n_sphere.convert_rectangular(c_list,10)\n>>> r_list\narray([[2., 3., 4., 5., 6.],\n [4., 1., 3., 6., 7.],\n [2., 2., 2., 2., 2.],\n [4., 9., 1., 2., 8.]])\n>>>\n```\n\n# Contact Us\nyunseong14@naver.com\n\n# Reference\n- [N-sphere](https://en.wikipedia.org/wiki/N-sphere)\n- [Stereographic projection](https://en.wikipedia.org/wiki/Stereographic_projection)\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/Yunseong-Jeong/n_sphere/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Yunseong-Jeong/n_sphere", "keywords": "Hyper Sphere,n-sphere,Spherical Coordinate,Rectangular Coordination,Python,Real Number", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "n-sphere", "package_url": "https://pypi.org/project/n-sphere/", "platform": "", "project_url": "https://pypi.org/project/n-sphere/", "project_urls": { "Download": "https://github.com/Yunseong-Jeong/n_sphere/archive/master.zip", "Homepage": "https://github.com/Yunseong-Jeong/n_sphere" }, "release_url": "https://pypi.org/project/n-sphere/1.2.0/", "requires_dist": [ "torch", "numpy" ], "requires_python": ">=3", "summary": "Convert to Spherical Coordination or Rectangular Coordination in Python", "version": "1.2.0", "yanked": false, "yanked_reason": null }, "last_serial": 6252584, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "44d674e4c45672c34a798617731baf1e", "sha256": "e7db8158227d9a5d20a349927a45c624846f2ed43b03278b37f2c8bf213b932c" }, "downloads": -1, "filename": "n_sphere-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "44d674e4c45672c34a798617731baf1e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2018, "upload_time": "2019-10-11T08:47:53", "upload_time_iso_8601": "2019-10-11T08:47:53.247187Z", "url": "https://files.pythonhosted.org/packages/d3/13/c7497fdb31cac303c6ec26dfd10efe8361f7f50464bb11eece1a66bda956/n_sphere-0.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b9c87bb23ecadf1fe85c5b583c532069", "sha256": "4af3d7846285fb0b940b3237beefbd30653a005ea4abcc463a2c1968fff51be5" }, "downloads": -1, "filename": "n_sphere-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "b9c87bb23ecadf1fe85c5b583c532069", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2010, "upload_time": "2019-10-11T08:52:10", "upload_time_iso_8601": "2019-10-11T08:52:10.489627Z", "url": "https://files.pythonhosted.org/packages/78/7d/4df0ce72ecb508814668d48dc9cfb8401274cbe79662cf90d56f341ec70a/n_sphere-0.0.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "213716763cffe680d5f7e0a7e88d96c8", "sha256": "4908b3a4f6215dde77d72bcc2afffba81c155180936d77d214c2f8d8330ef5ce" }, "downloads": -1, "filename": "n_sphere-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "213716763cffe680d5f7e0a7e88d96c8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2003, "upload_time": "2019-10-11T09:13:35", "upload_time_iso_8601": "2019-10-11T09:13:35.114015Z", "url": "https://files.pythonhosted.org/packages/d4/40/b666efc1a1832715f26410c7daf9f78271b1f77dc38ce212ab8f4fb84950/n_sphere-1.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "1dfc9b447b97a4e7e9dfe1c5b6355d75", "sha256": "58e912c49cb75df0d508d48da7dae9931e7edbd173d39b215233e62a035418e6" }, "downloads": -1, "filename": "n_sphere-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1dfc9b447b97a4e7e9dfe1c5b6355d75", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2014, "upload_time": "2019-10-14T07:58:34", "upload_time_iso_8601": "2019-10-14T07:58:34.311920Z", "url": "https://files.pythonhosted.org/packages/a9/f1/bf6f62b0515f63ec5bc78be966f9618a93d6cf00d20f08487bb137a30421/n_sphere-1.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f4fa1c0e9497f68bf65437565dd21732", "sha256": "1dd6e3092b9eff2bde7378967bb421a5cf7cce6ffa9d3efafeac468cc9cc1c68" }, "downloads": -1, "filename": "n_sphere-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f4fa1c0e9497f68bf65437565dd21732", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 2044, "upload_time": "2019-10-14T08:59:54", "upload_time_iso_8601": "2019-10-14T08:59:54.450780Z", "url": "https://files.pythonhosted.org/packages/70/23/96f79d9ee128a4d8d15aeef8455e8800677b94da6c438aaa750b468694b2/n_sphere-1.0.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.8.1": [ { "comment_text": "", "digests": { "md5": "b97ccd1df22190339ef7d0ae738ce6cd", "sha256": "210632f9cc7209a22cdb62eddeb78ef10d0675e1ec7ffab2232248716d562cd0" }, "downloads": -1, "filename": "n_sphere-1.0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b97ccd1df22190339ef7d0ae738ce6cd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 3092, "upload_time": "2019-10-22T09:33:24", "upload_time_iso_8601": "2019-10-22T09:33:24.654871Z", "url": "https://files.pythonhosted.org/packages/89/d4/171b3ec1310c45552ab3eadec5cd74ecf344f8a9308122dbfdd46064dabd/n_sphere-1.0.8.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.1.0": [], "1.2.0": [ { "comment_text": "", "digests": { "md5": "a6a5b16046cf96ea1b364a6df92d4d89", "sha256": "9c2ad1514c13d47f75230d481659851e443d4e44fb073ef9b33f8303a6df548f" }, "downloads": -1, "filename": "n_sphere-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a6a5b16046cf96ea1b364a6df92d4d89", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5274, "upload_time": "2019-12-06T05:53:14", "upload_time_iso_8601": "2019-12-06T05:53:14.245144Z", "url": "https://files.pythonhosted.org/packages/6f/7a/a9f3efeb4a56636f6ec9c891526e371af24dd69533b235e58036ce0dacd3/n_sphere-1.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a6a5b16046cf96ea1b364a6df92d4d89", "sha256": "9c2ad1514c13d47f75230d481659851e443d4e44fb073ef9b33f8303a6df548f" }, "downloads": -1, "filename": "n_sphere-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a6a5b16046cf96ea1b364a6df92d4d89", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5274, "upload_time": "2019-12-06T05:53:14", "upload_time_iso_8601": "2019-12-06T05:53:14.245144Z", "url": "https://files.pythonhosted.org/packages/6f/7a/a9f3efeb4a56636f6ec9c891526e371af24dd69533b235e58036ce0dacd3/n_sphere-1.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }