{"id":2947,"date":"2022-11-24T17:59:54","date_gmt":"2022-11-24T12:29:54","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=2947"},"modified":"2022-11-24T17:59:54","modified_gmt":"2022-11-24T12:29:54","slug":"using-julia-from-mathematica","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/","title":{"rendered":"Using Julia from Mathematica"},"content":{"rendered":"<p>In an <a href=\"https:\/\/www.rangakrish.com\/index.php\/2016\/07\/22\/using-julia-to-interact-with-mathematica\/\" target=\"_blank\" rel=\"noopener\"><em><strong>earlier article<\/strong><\/em><\/a>, I had shown how it is possible to interact with <a href=\"https:\/\/www.wolfram.com\/mathematica\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Mathematica<\/strong><\/em><\/a> from <a href=\"https:\/\/julialang.org\/\" target=\"_blank\" rel=\"noopener\"><em><strong>Julia<\/strong><\/em><\/a>. In today\u2019s article, I will share the details of how to interact with <em><strong>Julia<\/strong><\/em> from within <em><strong>Mathematica<\/strong><\/em>.<\/p>\n<p>Why would somebody want to execute <em><strong>Julia<\/strong><\/em> code inside <em><strong>Mathematica<\/strong><\/em>? Although <em><strong>Mathematica<\/strong><\/em> is a great symbolic computing environment offering thousands of functions covering several areas, I might want to reuse some feature I have already implemented in <em><strong>Julia<\/strong><\/em> as part of some other project. Another reason is that sometimes implementing an algorithm in <em><strong>Julia<\/strong><\/em> to take advantage of multiple cores\/GPU might give us better performance than implementing that algorithm in <em><strong>Mathematica<\/strong><\/em>. There could be other valid reasons.<\/p>\n<p>In order to interact with <em><strong>Julia<\/strong><\/em>, first we must have installed Julia on our machine. In my case, I have Julia 1.8.2 running on my machine. In addition, <em><strong>Mathematica<\/strong><\/em> requires two packages <em><strong>\u201cZMQ\u201d<\/strong><\/em> and <em><strong>\u201cJSON\u201d<\/strong><\/em> to be installed in <em><strong>Julia<\/strong><\/em>. So, I did that:<\/p>\n<figure id=\"attachment_2948\" aria-describedby=\"caption-attachment-2948\" style=\"width: 598px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"2948\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/julia-shell\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png\" data-orig-size=\"598,346\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Installing Julia\" data-image-description=\"&lt;p&gt;Installing Julia&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Installing Julia&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png\" class=\"wp-image-2948 size-full\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?resize=598%2C346&#038;ssl=1\" alt=\"Installing Julia\" width=\"598\" height=\"346\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?w=598&amp;ssl=1 598w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?resize=300%2C174&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><figcaption id=\"caption-attachment-2948\" class=\"wp-caption-text\"><strong>Installing Julia<\/strong><\/figcaption><\/figure>\n<p>After installing the required packages, we can exit <em><strong>Julia<\/strong><\/em>. It need not be running in order to use from <em><strong>Mathematica<\/strong><\/em>.<\/p>\n<p>Next we launch <em><strong>Mathematica<\/strong><\/em>. To check if <em><strong>Julia<\/strong><\/em> is\u00a0 accessible, we evaluate the function <em><strong>\u201cFindExternalEvaluators[]\u201d<\/strong><\/em>.<\/p>\n<figure id=\"attachment_2949\" aria-describedby=\"caption-attachment-2949\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2949\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/findexternaleval\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png\" data-orig-size=\"804,114\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"External Evaluators\" data-image-description=\"&lt;p&gt;External Evaluators&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;External Evaluators&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png\" class=\"wp-image-2949\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?resize=650%2C92&#038;ssl=1\" alt=\"External Evaluators\" width=\"650\" height=\"92\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?resize=300%2C43&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?resize=768%2C109&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?resize=800%2C114&amp;ssl=1 800w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/FindExternalEval.png?w=804&amp;ssl=1 804w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/a><figcaption id=\"caption-attachment-2949\" class=\"wp-caption-text\"><strong>External Evaluators<\/strong><\/figcaption><\/figure>\n<p><em><strong>Mathematica<\/strong><\/em> responds with details of the <em><strong>Julia<\/strong><\/em> installation.<\/p>\n<p>There are three ways to interact with <em><strong>Julia<\/strong><\/em>. The most general is to call <em><strong>\u201cExternalEvaluate[]\u201d<\/strong><\/em> function.<\/p>\n<figure id=\"attachment_2950\" aria-describedby=\"caption-attachment-2950\" style=\"width: 651px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"2950\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/externalevaluate-4\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png\" data-orig-size=\"807,129\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"ExternalEvaluate Function\" data-image-description=\"&lt;p&gt;ExternalEvaluate Function&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;ExternalEvaluate Function&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png\" class=\"wp-image-2950\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?resize=651%2C104&#038;ssl=1\" alt=\"ExternalEvaluate Function\" width=\"651\" height=\"104\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?resize=300%2C48&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?resize=768%2C123&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?resize=800%2C129&amp;ssl=1 800w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/ExternalEvaluate.png?w=807&amp;ssl=1 807w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/a><figcaption id=\"caption-attachment-2950\" class=\"wp-caption-text\"><strong>ExternalEvaluate Function<\/strong><\/figcaption><\/figure>\n<p>The second way is to explicitly create a <em><strong>Julia<\/strong><\/em> session object using <em><strong>\u201cStartExternalSession[]\u201d<\/strong><\/em> function once and then pass the session object as an argument to <em><strong>\u201cExternalEvaluate[]\u201d<\/strong><\/em> subsequently.<\/p>\n<figure id=\"attachment_2952\" aria-describedby=\"caption-attachment-2952\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2952\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/sessioneval\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png\" data-orig-size=\"715,310\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Creating Explicit Julia Session\" data-image-description=\"&lt;p&gt;Creating Explicit Julia Session&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Creating Explicit Julia Session&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png\" class=\"wp-image-2952\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png?resize=600%2C260&#038;ssl=1\" alt=\"Creating Explicit Julia Session\" width=\"600\" height=\"260\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png?resize=300%2C130&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval.png?w=715&amp;ssl=1 715w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-2952\" class=\"wp-caption-text\"><strong>Creating Explicit Julia Session<\/strong><\/figcaption><\/figure>\n<p>Notice that for calling a <em><strong>Julia<\/strong><\/em> function, we are using <em><strong>\u201c[]\u201d<\/strong><\/em> and not <em><strong>\u201c()\u201d<\/strong><\/em>.<\/p>\n<p>The nice thing is that we can now mix <em><strong>Julia <\/strong><\/em>and <em><strong>Mathematica<\/strong><\/em> expressions:<\/p>\n<figure id=\"attachment_2953\" aria-describedby=\"caption-attachment-2953\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2953\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/sessioneval2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png\" data-orig-size=\"716,182\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Mixing Julia and Mathematica Expressions\" data-image-description=\"&lt;p&gt;Mixing Julia and Mathematica Expressions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Mixing Julia and Mathematica Expressions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png\" class=\"wp-image-2953\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png?resize=600%2C153&#038;ssl=1\" alt=\"Mixing Julia and Mathematica Expressions\" width=\"600\" height=\"153\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png?resize=300%2C76&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/SessionEval2.png?w=716&amp;ssl=1 716w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-2953\" class=\"wp-caption-text\"><strong>Mixing Julia and Mathematica Expressions<\/strong><\/figcaption><\/figure>\n<p>Here we are calling the previously defined <em><strong>Julia<\/strong><\/em> function <em><strong>\u201cfactfn[]\u201d<\/strong><\/em> inside the <em><strong>Mathematica<\/strong><\/em> function <em><strong>\u201cSort[]\u201d<\/strong><\/em>. Also note that the function <em><strong>\u201cDeleteObject[]\u201d<\/strong><\/em> has to be called when the <em><strong>Julia<\/strong><\/em> session object is not needed anymore.<\/p>\n<p>The third way to interact with <em><strong>Julia<\/strong><\/em> is through the <em><strong>\u201cJulia Cell\u201d<\/strong><\/em>. For this, type <em><strong>\u201c&gt;\u201d<\/strong><\/em> in the <em><strong>Mathematica<\/strong><\/em> Notebook. This will bring up an evaluation <em><strong>Cell<\/strong><\/em> corresponding to the default language (in my case, <em><strong>\u201cPython\u201d)<\/strong><\/em>. When you click on the <em><strong>Cell<\/strong><\/em> icon, a drop-down menu will appear. Select <em><strong>\u201cJulia\u201d<\/strong><\/em> from this list.<\/p>\n<figure id=\"attachment_2954\" aria-describedby=\"caption-attachment-2954\" style=\"width: 156px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/CellOptions.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2954\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/celloptions\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/CellOptions.png\" data-orig-size=\"156,269\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Cell Options\" data-image-description=\"&lt;p&gt;Cell Options&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Cell Options&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/CellOptions.png\" class=\"size-full wp-image-2954\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/CellOptions.png?resize=156%2C269&#038;ssl=1\" alt=\"Cell Options\" width=\"156\" height=\"269\" \/><\/a><figcaption id=\"caption-attachment-2954\" class=\"wp-caption-text\"><strong>Cell Options<\/strong><\/figcaption><\/figure>\n<p>This will change the current <em><strong>Cell<\/strong><\/em> to <em><strong>Julia<\/strong><\/em> mode. You can now enter any <em><strong>Julia<\/strong><\/em> code in this <em><strong>Cell<\/strong><\/em>. Next time onward, when you type <em><strong>\u201c&gt;\u201d<\/strong><\/em>, the <em><strong>Julia Cell<\/strong> <\/em>comes up automatically.<\/p>\n<p>This mode is convenient when your primary focus is <em><strong>Julia<\/strong><\/em> mode. Remember that in this mode, you cannot use non-<em><strong>Julia<\/strong><\/em> expressions\/commands.<\/p>\n<p>As shown above, interacting with <em><strong>Julia<\/strong><\/em> inside <em><strong>Mathematica<\/strong><\/em> is a simple process and is quite useful when you wish to take advantage of <em><strong>Julia\u2019s<\/strong><\/em> special capabilities inside <em><strong>Mathematica<\/strong><\/em>.<\/p>\n<p>About my test environment: I am using <em><strong>Julia 1.8.2<\/strong><\/em> and <em><strong>Mathematica 13.1<\/strong> <\/em>on my <em><strong>iMac<\/strong><\/em>.<\/p>\n<p>Have a great weekend!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In an earlier article, I had shown how it is possible to interact with Mathematica from Julia. In today\u2019s article, I will share the details of how to interact with Julia from within Mathematica. Why would somebody want to execute Julia code inside Mathematica? Although Mathematica is a great symbolic computing environment offering thousands of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[63,72,17],"tags":[],"class_list":["post-2947","post","type-post","status-publish","format-standard","hentry","category-julia","category-mathematica","category-programming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-Lx","jetpack-related-posts":[{"id":285,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/07\/22\/using-julia-to-interact-with-mathematica\/","url_meta":{"origin":2947,"position":0},"title":"Using Julia to Interact with Mathematica","author":"admin","date":"July 22, 2016","format":false,"excerpt":"Mathematica is a powerful environment for symbolic and numerical computation. I have been using it for many years now. In this post\u00a0I had explained how we can use Mathematica bundled with Raspberry distribution to control littleBits devices. When I saw that there is support in Julia for interacting with Mathematica,\u2026","rel":"","context":"In &quot;Julia&quot;","block_context":{"text":"Julia","link":"https:\/\/www.rangakrish.com\/index.php\/category\/julia\/"},"img":{"alt_text":"Julia Session","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/07\/Julia-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3626,"url":"https:\/\/www.rangakrish.com\/index.php\/2025\/02\/21\/using-openai-from-mathematica-part-3\/","url_meta":{"origin":2947,"position":1},"title":"Using OpenAI from Mathematica: Part-3","author":"admin","date":"February 21, 2025","format":false,"excerpt":"Let us continue our discussion on using Mathematica to interact with OpenAI (you may want to go through the earlier article as well). The simplest function to interact with the LLM is LLMSynthesize[]. As you might have guessed, this is a \u201csync\u201d (non-streaming) call. What if you expect a long\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Basic LLMSynthesize","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/02\/fig1-300x21.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1594,"url":"https:\/\/www.rangakrish.com\/index.php\/2019\/06\/08\/using-nodejs-in-mathematica-12\/","url_meta":{"origin":2947,"position":2},"title":"Using NodeJS in Mathematica 12","author":"admin","date":"June 8, 2019","format":false,"excerpt":"In an earlier article, I had described Python integration in Mathematica 12. In addition to Python, NodeJS is also supported as a default \u201cexternal\u201d language. In today\u2019s article, I will focus on NodeJS integration. By the way, NodeJS support was introduced in Mathematica 11.2. Before using NodeJS with Mathematica 12,\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"NodeJS Session Continued","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/06\/Session2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/06\/Session2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/06\/Session2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2019\/06\/Session2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":317,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/08\/31\/geo-computation-in-mathematica\/","url_meta":{"origin":2947,"position":3},"title":"Geo Computation in Mathematica","author":"admin","date":"August 31, 2016","format":false,"excerpt":"Mathematica has many useful features when it comes to Geo Computation. I wanted to check out some of these features for today's post. I travel between Chennai and Bengaluru on official work. So, let us start by determining the on-road distance between these cities. It turns out that this is\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Distance","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/08\/Fig-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/08\/Fig-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/08\/Fig-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3807,"url":"https:\/\/www.rangakrish.com\/index.php\/2025\/09\/12\/cyclic-function-in-mathematica-14-3\/","url_meta":{"origin":2947,"position":4},"title":"&#8220;Cyclic&#8221; Function in Mathematica 14.3","author":"admin","date":"September 12, 2025","format":false,"excerpt":"\u201cCyclic\u201d is a new function introduced in the recent Wolfram Mathematica 14.3 release. It represents a repeating sequence, something that we encounter often. For example, how do we represent the sequence {1,2,3,4,1,2,3,4,1,2,3,4\u2026}? \u201cCyclic\u201d captures this idea. In other words \u201cCyclic[{1,2,3,4}]\u201d denotes the same repeating sequence as above. Other examples: weekdays\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Accessing Cyclic Elements","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/09\/access-283x300.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":348,"url":"https:\/\/www.rangakrish.com\/index.php\/2016\/09\/26\/computer-vision-with-mathematica\/","url_meta":{"origin":2947,"position":5},"title":"Computer Vision with Mathematica","author":"admin","date":"September 26, 2016","format":false,"excerpt":"Over the past several weeks, I have been discussing many interesting features of Mathematica. As a continuation, today, I would like to show some cool functionality in the domain of computer vision and machine learning. The function ImageIdentify[] tries to identify the object in the given image. According to the\u2026","rel":"","context":"In &quot;Machine Learning&quot;","block_context":{"text":"Machine Learning","link":"https:\/\/www.rangakrish.com\/index.php\/category\/machine-learning\/"},"img":{"alt_text":"A Truck","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2016\/09\/truck-fig.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=2947"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/2947\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=2947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=2947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=2947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}