{"id":1653,"date":"2022-11-05T00:30:51","date_gmt":"2022-11-05T07:30:51","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1653"},"modified":"2022-11-05T22:41:44","modified_gmt":"2022-11-06T05:41:44","slug":"210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2-2","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/11\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2-2\/","title":{"rendered":"#314 Mandelbrot Set in ASCII format using C#"},"content":{"rendered":"<p><a href=\"https:\/\/gantovnik.com\/bio-tips\/2022\/11\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2-2\/ex314\/\" rel=\"attachment wp-att-1654\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex314.png?resize=247%2C300&#038;ssl=1\" alt=\"\" width=\"247\" height=\"300\" class=\"alignnone size-medium wp-image-1654\" \/><\/a><\/p>\n<p>Program.cs<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n\r\nclass Mandelbrot_set\r\n{\r\n    static void Main(string&#x5B;] args)\r\n    {\r\n        double realCoord, imagCoord;\r\n        double realTemp, imagTemp, realTemp2, arg;\r\n        int iterations;\r\n        for (imagCoord = 1.2; imagCoord &gt;= -1.2; imagCoord -= 0.05)\r\n        {\r\n            for (realCoord = -0.6; realCoord &lt;= 1.77; realCoord += 0.03)\r\n            {\r\n                iterations = 0;\r\n                realTemp = realCoord;\r\n                imagTemp = imagCoord;\r\n                arg = (realCoord * realCoord) + (imagCoord * imagCoord);\r\n                while ((arg &lt; 4) &amp;&amp; (iterations &lt; 40))\r\n                {\r\n                    realTemp2 = (realTemp * realTemp) - (imagTemp * imagTemp)\r\n                    - realCoord;\r\n                    imagTemp = (2 * realTemp * imagTemp) - imagCoord;\r\n                    realTemp = realTemp2;\r\n                    arg = (realTemp * realTemp) + (imagTemp * imagTemp);\r\n                    iterations += 1;\r\n                }\r\n                switch (iterations % 4)\r\n                {\r\n                    case 0:\r\n                        Console.Write(&quot;0&quot;);\r\n                        break;\r\n                    case 1:\r\n                        Console.Write(&quot;1&quot;);\r\n                        break;\r\n                    case 2:\r\n                        Console.Write(&quot;2&quot;);\r\n                        break;\r\n                    case 3:\r\n                        Console.Write(&quot;3&quot;);\r\n                        break;\r\n                }\r\n            }\r\n            Console.Write(&quot;\\n&quot;);\r\n        }\r\n        Console.ReadKey();\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Program.cs class Mandelbrot_set { static void Main(string&#x5B;] args) { double realCoord, imagCoord; double realTemp, imagTemp, realTemp2, arg; int iterations; for (imagCoord = 1.2; imagCoord &gt;= -1.2; imagCoord -= 0.05) { for (realCoord = -0.6; realCoord &lt;= 1.77; realCoord += 0.03) { iterations = 0; realTemp = realCoord; imagTemp = imagCoord; arg = (realCoord * realCoord) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[50],"tags":[55],"class_list":["post-1653","post","type-post","status-publish","format-standard","hentry","category-c","tag-mandelbrot"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-qF","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1742,"url":"https:\/\/gantovnik.com\/bio-tips\/2023\/01\/204-mandelbrot-fractal-using-python-2-2-2-2-2-2-2-2-2\/","url_meta":{"origin":1653,"position":0},"title":"#330 Gradient method using python","author":"gantovnik","date":"2023-01-03","format":false,"excerpt":"golden.py [code language=\"python\"] import math as mt def golden(f,a,b,tol=1.0e-10): # Golden section method for determining x # that minimizes the scalar function f(x). # The minimum must be bracketed in (a,b). c1 = (mt.sqrt(5.0)-1.0)\/2.0 c2 = 1.0 - c1 nIt = int(mt.ceil(mt.log(tol\/abs(a-b))\/mt.log(c1))) # first step x1 = c1*a + c2*b\u2026","rel":"","context":"In &quot;optimization&quot;","block_context":{"text":"optimization","link":"https:\/\/gantovnik.com\/bio-tips\/category\/optimization\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2023\/01\/ex330.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1176,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/204-mandelbrot-fractal-using-python\/","url_meta":{"origin":1653,"position":1},"title":"#204 Mandelbrot fractal using python","author":"gantovnik","date":"2021-11-26","format":false,"excerpt":"[code language=\"python\"] import numpy as np import matplotlib.pyplot as plt def mandelbrot(h,w, maxit=20): x,y = np.meshgrid(np.linspace(-2, 0.8, w), np.linspace(-1.4, 1.4, h)) c = x + y*1j z = c exceeds = np.zeros(z.shape, dtype=bool) for iteration in range(maxit): z = z**2 + c exceeded = abs(z) > 4 exceeds_now = exceeded\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex204.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1723,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/12\/204-mandelbrot-fractal-using-python-2-2-2-2-2-2-2\/","url_meta":{"origin":1653,"position":2},"title":"#326 Vertical box plot using python","author":"gantovnik","date":"2022-12-14","format":false,"excerpt":"[code language=\"python\"] import numpy as np import matplotlib.pyplot as plt import pandas as pd df = pd.DataFrame(np.random.rand(10, 5),columns=['A', 'B', 'C', 'D', 'E']) color = dict(boxes='DarkGreen', whiskers='Red', medians='Blue', caps='Gray') plt.figure() df.plot.box(color=color, sym='r+') plt.savefig('ex326.png', dpi=100) plt.show() [\/code]","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/12\/ex326.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1194,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/204-mandelbrot-fractal-using-python-2-2-2-2-2\/","url_meta":{"origin":1653,"position":3},"title":"#209 3D wireframe plots","author":"gantovnik","date":"2021-11-27","format":false,"excerpt":"[code language=\"python\"] from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(8, 12), subplot_kw={'projection': '3d'}) # Get the test data X, Y, Z = axes3d.get_test_data(0.05) # Give the first plot only wireframes of the type y = c ax1.plot_wireframe(X, Y, Z, rstride=10, cstride=0) ax1.set_title(&quot;Column (x)\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex209.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex209.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2021\/11\/ex209.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1112,"url":"https:\/\/gantovnik.com\/bio-tips\/2021\/11\/194-solving-of-system-of-linear-equations-in-python-gauss-seidel-method\/","url_meta":{"origin":1653,"position":4},"title":"#194 Solving of system of linear equations in python (Gauss-Seidel method)","author":"gantovnik","date":"2021-11-19","format":false,"excerpt":"[code language=\"python\"] import numpy as np # solve system of linear equation using # Gauss-Seidel method using # a predefined threshold eps=0.01 # 8*x1+3*x2-3*x3=14 # -2*x1-8*x2+5*x3=5 # 3*x1+5*x2+10*x3=-8 # first check if the coefficient matrix is # diagonally dominant or not. a = [[8, 3, -3], [-2, -8, 5], [3,\u2026","rel":"","context":"In &quot;python&quot;","block_context":{"text":"python","link":"https:\/\/gantovnik.com\/bio-tips\/category\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1686,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/11\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2-2-3\/","url_meta":{"origin":1653,"position":5},"title":"#319 Scatter plot using ScottPlot.WinForms and C#","author":"gantovnik","date":"2022-11-29","format":false,"excerpt":"1) Install the ScottPlot.WinForms NuGet package 2) Drag a FormsPlot from the toolbox onto the form Form1.cs [code language=\"csharp\"] namespace WinFormsAppEx319 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void formsPlot1_Load(object sender, EventArgs e) { \/\/ generate some random X\/Y data int pointCount =\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/ex319.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1653"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1653\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}