{"id":166,"date":"2024-09-30T10:00:46","date_gmt":"2024-09-30T09:00:46","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=166"},"modified":"2024-09-30T10:00:46","modified_gmt":"2024-09-30T09:00:46","slug":"mwnci-cos-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-cos-function\/","title":{"rendered":"Mwnci cos() Function"},"content":{"rendered":"<h2><span id=\"Syntax\" class=\"mw-headline\">Syntax<\/span><\/h2>\n<p>cos(<i><b>radians<\/b><\/i>)<\/p>\n<h2><span id=\"Description\" class=\"mw-headline\">Description<\/span><\/h2>\n<p>The <i>cos()<\/i> function returns the cosine of <i>radians<\/i>. The output range for the cos() function is -1 \u2264 cos() \u2264 1.<\/p>\n<h2><span id=\"Example\" class=\"mw-headline\">Example<\/span><\/h2>\n<pre>print(\"Cosine Waveform: \\n\\n\")\r\nprint(\"     -1 -0.5   0   0.5   1\\n\")\r\nprint(\"     +----+----+----+----+\\n\")\r\ni=0.0\r\nwhile (i &lt;= 3.2) {\r\n    printf(\"%4.2f \", i)\r\n    cosine=cos(i)\r\n    plot=int(10 * cosine) + 10\r\n    if (plot &lt; 10) {\r\n        before=\"\"\r\n\tj=1\r\n\twhile (j &lt;= plot) {\r\n\t    before= before + \" \"\r\n\t    j++\r\n\t}\r\n\tafter=\"\"\r\n\tj = plot\r\n\twhile (j &lt; 9) {\r\n\t    after=after + \" \"\r\n\t    j++\r\n\t}\r\n\tprint(before, \"*\", after, \"|\")\r\n\tprintf(\"              cosine =\u00a0%+8.6f\\n\", cosine)\r\n    } else {\r\n        if (plot == 10) {\r\n\t    print(\"          *\")\r\n\t    printf(\"              cosine =\u00a0%+8.6f\\n\", cosine)\r\n\t} else {\r\n\t        print(\"          |\")\r\n\t\tbefore=\"\"\r\n\t\tj=11\r\n\t\twhile (j &lt; plot) {\r\n\t\t    before=before + \" \"\r\n\t\t    j++\r\n\t\t}\r\n\t\tprint(before, \"*\")\r\n\t\tafter=\"\"\r\n\t\tj=plot+1\r\n\t\twhile (j &lt;= 24) {\r\n\t\t    after=after + \" \"\r\n\t\t    j++\r\n\t\t}\r\n\t\tprint(after)\r\n\t\tprintf(\"cosine =\u00a0%+8.6f\\n\", cosine)\r\n        }\r\n    }\r\n\ti =i + 0.1\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax cos(radians) Description The cos() function returns the cosine of radians. The output range for the cos() function is -1 \u2264 cos() \u2264 1. Example print(&#8220;Cosine Waveform: \\n\\n&#8221;) print(&#8221; -1 -0.5 0 0.5 1\\n&#8221;) print(&#8221; +&#8212;-+&#8212;-+&#8212;-+&#8212;-+\\n&#8221;) i=0.0 while (i &lt;= 3.2) { printf(&#8220;%4.2f &#8220;, i) cosine=cos(i) plot=int(10 * cosine) + 10 if (plot &lt; 10) &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-cos-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci cos() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-166","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/166\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/166\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}