{"id":4322,"date":"2026-07-08T15:26:52","date_gmt":"2026-07-08T09:56:52","guid":{"rendered":"https:\/\/www.rangakrish.com\/?p=4322"},"modified":"2026-07-08T15:26:52","modified_gmt":"2026-07-08T09:56:52","slug":"amazing-pattern-matching-capabilities-of-wolfram-mathematica","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/","title":{"rendered":"Amazing Pattern Matching Capabilities of Wolfram Mathematica"},"content":{"rendered":"<p><em><strong>Wolfram Mathematica<\/strong><\/em> is one of the best tools available today for symbolic computation, primarily involving Mathematics. What is quite amazing about it is its pattern matching features. It is not too much of an exaggeration to say that all the language features are built around some form of pattern matching. A complete book can be written on this topic, but I will attempt to cover some of the salient aspects in this article.<\/p>\n<p>When many of us heart the term <em><strong>\u201cpattern matching\u201d<\/strong><\/em>, we immediately think of <em><strong>Regular Expressions<\/strong><\/em>. Mathematica\u2019s pattern language generalizes this idea to arbitrary symbolic expressions: lists, equations, trees, and a lot more.<\/p>\n<p>Let us consider the simple definition of a function.<\/p>\n<figure id=\"attachment_4323\" aria-describedby=\"caption-attachment-4323\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png?ssl=1\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"4323\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/function\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png\" data-orig-size=\"1568,354\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Function in Mathematica\" data-image-description=\"&lt;p&gt;Function in Mathematica&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Function in Mathematica&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function-1024x231.png\" class=\"wp-image-4323\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png?resize=600%2C135&#038;ssl=1\" alt=\"Function in Mathematica\" width=\"600\" height=\"135\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png?resize=300%2C68&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png?resize=1024%2C231&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/function.png?w=1568&amp;ssl=1 1568w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4323\" class=\"wp-caption-text\"><strong>Function in Mathematica<\/strong><\/figcaption><\/figure>\n<p>Thus, the function definition itself is a pattern that is expanded appropriately by the system.<\/p>\n<p><em><strong>Mathematica<\/strong><\/em> uses a compact (somewhat cryptic) pattern syntax. See below.<\/p>\n<figure id=\"attachment_4324\" aria-describedby=\"caption-attachment-4324\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"4324\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/patternexpression\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png\" data-orig-size=\"1536,412\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Pattern Expressions\" data-image-description=\"&lt;p&gt;Pattern Expressions&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Pattern Expressions&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression-1024x275.png\" class=\"wp-image-4324\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png?resize=600%2C161&#038;ssl=1\" alt=\"Pattern Expressions\" width=\"600\" height=\"161\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png?resize=300%2C80&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png?resize=1024%2C275&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/patternexpression.png?w=1536&amp;ssl=1 1536w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4324\" class=\"wp-caption-text\"><strong>Pattern Expressions<\/strong><\/figcaption><\/figure>\n<p>As an example, let us define a function that takes two integer arguments and sums their squares.<\/p>\n<figure id=\"attachment_4325\" aria-describedby=\"caption-attachment-4325\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"4325\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/example1-36\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png\" data-orig-size=\"1560,358\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Function with Typed Arguments\" data-image-description=\"&lt;p&gt;Function with Typed Arguments&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Function with Typed Arguments&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1-1024x235.png\" class=\"wp-image-4325\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png?resize=600%2C138&#038;ssl=1\" alt=\"Function with Typed Arguments\" width=\"600\" height=\"138\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png?resize=300%2C69&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png?resize=1024%2C235&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example1.png?w=1560&amp;ssl=1 1560w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4325\" class=\"wp-caption-text\"><strong>Function with Typed Arguments<\/strong><\/figcaption><\/figure>\n<p>In the above example, we have constrained the arguments to be <em><strong>\u201cIntegers\u201d<\/strong><\/em>. The function will be executed only when this condition is satisfied.<\/p>\n<p>Patterns become more powerful when we combine them with rules.<\/p>\n<figure id=\"attachment_4326\" aria-describedby=\"caption-attachment-4326\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4326\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/example2-31\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png\" data-orig-size=\"1572,294\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Patterns with Rules\" data-image-description=\"&lt;p&gt;Patterns with Rules&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Patterns with Rules&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2-1024x192.png\" class=\"wp-image-4326\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png?resize=600%2C112&#038;ssl=1\" alt=\"Patterns with Rules\" width=\"600\" height=\"112\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png?resize=300%2C56&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png?resize=1024%2C192&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example2.png?w=1572&amp;ssl=1 1572w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4326\" class=\"wp-caption-text\"><strong>Patterns with Rules<\/strong><\/figcaption><\/figure>\n<p>The first rule in the above example substitutes <em><strong>\u201cx\u201d<\/strong><\/em> with <em><strong>\u201c(y+z)\u201d<\/strong><\/em>. In the second, <em><strong>\u201cx\u201d<\/strong><\/em> is replaced by an integer value <em><strong>\u201c10\u201d<\/strong><\/em>.<\/p>\n<p>A variant of the above is <em><strong>\u201crepeated application of rules\u201d<\/strong><\/em>. Take a look at the following example:<\/p>\n<figure id=\"attachment_4327\" aria-describedby=\"caption-attachment-4327\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4327\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/example3-28\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png\" data-orig-size=\"1572,324\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Repeated Rule Application\" data-image-description=\"&lt;p&gt;Repeated Rule Application&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Repeated Rule Application&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3-1024x211.png\" class=\"wp-image-4327\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png?resize=600%2C124&#038;ssl=1\" alt=\"Repeated Rule Application\" width=\"600\" height=\"124\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png?resize=300%2C62&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png?resize=1024%2C211&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example3.png?w=1572&amp;ssl=1 1572w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4327\" class=\"wp-caption-text\"><strong>Repeated Rule Application<\/strong><\/figcaption><\/figure>\n<p>In the above example, the operator <em><strong>\u201c\/\/.\u201d<\/strong><\/em> applies the list of rules <em><strong>\u201crules\u201d<\/strong><\/em> on the expression <em><strong>\u201cexpressions\u201d<\/strong><\/em> until no more application is possible. The result is the final substitution arrived at. This is quite powerful.<\/p>\n<p>We also have the operator <em><strong>\u201c___\u201d<\/strong><\/em> matches zero or more elements. The following function checks if the given sequence has two equal adjacent elements:<\/p>\n<figure id=\"attachment_4328\" aria-describedby=\"caption-attachment-4328\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4328\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/example4-19\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png\" data-orig-size=\"1570,184\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Check for adjacent equal elements\" data-image-description=\"&lt;p&gt;Check for adjacent equal elements&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Check for adjacent equal elements&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4-1024x120.png\" class=\"wp-image-4328\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png?resize=600%2C70&#038;ssl=1\" alt=\"Check for adjacent equal elements\" width=\"600\" height=\"70\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png?resize=300%2C35&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png?resize=1024%2C120&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example4.png?w=1570&amp;ssl=1 1570w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4328\" class=\"wp-caption-text\"><strong>Check for adjacent equal elements<\/strong><\/figcaption><\/figure>\n<p>We can build upon the above further to implement a<span class=\"Apple-converted-space\">\u00a0 <\/span>compact way to sort a list of integers:<\/p>\n<figure id=\"attachment_4329\" aria-describedby=\"caption-attachment-4329\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4329\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2026\/07\/08\/amazing-pattern-matching-capabilities-of-wolfram-mathematica\/example5-15\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png\" data-orig-size=\"1564,144\" 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;,&quot;alt&quot;:&quot;&quot;}\" data-image-title=\"Sorting a list of integers\" data-image-description=\"&lt;p&gt;Sorting a list of integers&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Sorting a list of integers&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5-1024x94.png\" class=\"wp-image-4329\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png?resize=600%2C55&#038;ssl=1\" alt=\"Sorting a list of integers\" width=\"600\" height=\"55\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png?resize=300%2C28&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png?resize=1024%2C94&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/07\/example5.png?w=1564&amp;ssl=1 1564w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><figcaption id=\"caption-attachment-4329\" class=\"wp-caption-text\"><strong>Sorting a list of integers<\/strong><\/figcaption><\/figure>\n<p>It has to be understood like this: <em><strong>&#8220;as long as the list contains some prefix, then two adjacent elements in the wrong order, then some suffix \u2014 swap them.&#8221;<\/strong><\/em> How succinct!<\/p>\n<p>I can go on and on, but I will stop here for now. Hope you now have a glimpse of the pattern matching capabilities of <em><strong>Mathematica<\/strong><\/em>.<\/p>\n<p>I have used <em><strong>Wolfram Mathematica Professional ver 14.3<\/strong><\/em> for this article. You can download the notebook <a href=\"https:\/\/www.rangakrish.com\/downloads\/PatternMatching.nb\" target=\"_blank\" rel=\"noopener\"><em><strong>here<\/strong><\/em><\/a>.<\/p>\n<p>Have a nice day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wolfram Mathematica is one of the best tools available today for symbolic computation, primarily involving Mathematics. What is quite amazing about it is its pattern matching features. It is not too much of an exaggeration to say that all the language features are built around some form of pattern matching. A complete book can be [&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_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_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},"jetpack_post_was_ever_published":false},"categories":[72,17],"tags":[43,62],"class_list":["post-4322","post","type-post","status-publish","format-standard","hentry","category-mathematica","category-programming","tag-mathematica","tag-pattern-matching"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-17I","jetpack-related-posts":[{"id":2084,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/08\/16\/pattern-matching-comparing-elixir-and-mathematica\/","url_meta":{"origin":4322,"position":0},"title":"Pattern Matching: Comparing Elixir and Mathematica","author":"admin","date":"August 16, 2020","format":false,"excerpt":"One of the things I like about Elixir\u00a0is its support for patterns at the core language level, not through library functions as in most other languages. This contributes to writing cleaner code, in my opinion. \u00a0 Another environment that I am familiar with, namely Mathematica, boasts of (arguably) the most\u2026","rel":"","context":"In &quot;Elixir&quot;","block_context":{"text":"Elixir","link":"https:\/\/www.rangakrish.com\/index.php\/category\/elixir\/"},"img":{"alt_text":"Symbolic Expressions","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/08\/pattern-mm.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":4348,"url":"https:\/\/www.rangakrish.com\/index.php\/2026\/08\/29\/freeformevaluate-function-in-wolfram-mathematica\/","url_meta":{"origin":4322,"position":1},"title":"FreeformEvaluate Function in Wolfram Mathematica","author":"admin","date":"August 29, 2026","format":false,"excerpt":"Mathematica has supported free-form linguistic input for years, but the function FreeformEvaluate introduced in ver 14.1 makes that capability more functional for developers. FreeformEvaluate basically accepts a natural language expression or query and returns the corresponding answer.\u00a0 Let us look at some examples. Instead of computing the 24th Fibonacci number\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Numerical Evaluation","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/08\/Image1-300x113.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/08\/Image1-300x113.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/08\/Image1-300x113.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2947,"url":"https:\/\/www.rangakrish.com\/index.php\/2022\/11\/24\/using-julia-from-mathematica\/","url_meta":{"origin":4322,"position":2},"title":"Using Julia from Mathematica","author":"admin","date":"November 24, 2022","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;Julia&quot;","block_context":{"text":"Julia","link":"https:\/\/www.rangakrish.com\/index.php\/category\/julia\/"},"img":{"alt_text":"Installing Julia","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2022\/11\/Julia-Shell.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3545,"url":"https:\/\/www.rangakrish.com\/index.php\/2024\/11\/09\/semantic-search-in-wolfram-mathematica\/","url_meta":{"origin":4322,"position":3},"title":"Semantic Search in Wolfram Mathematica","author":"admin","date":"November 9, 2024","format":false,"excerpt":"In an earlier article, I explained how to use OpenAI from Wolfram Mathematica ver 14.1. This latest release of Wolfram supports Semantic Search as well. In today\u2019s article, let me discuss this feature. As in the case of using LLMs, using Semantic Search requires an account with one of the\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Remedy Description","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2024\/11\/image1-300x225.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3794,"url":"https:\/\/www.rangakrish.com\/index.php\/2025\/08\/19\/stock-analysis-with-wolfram-mathematica-part-2\/","url_meta":{"origin":4322,"position":4},"title":"Stock Analysis with Wolfram Mathematica &#8211; Part 2","author":"admin","date":"August 19, 2025","format":false,"excerpt":"In the previous article, I had explained how to get started using Wolfram Mathematica\u2019s stock analysis features. The focus was on working with the exchanges supported by Mathematica, for example BSE India. What if we have stock data from a different source and want to analyze it in Mathematica? In\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Loading the CSV Data","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/08\/processdata-fn-300x149.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/08\/processdata-fn-300x149.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2025\/08\/processdata-fn-300x149.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":4285,"url":"https:\/\/www.rangakrish.com\/index.php\/2026\/04\/22\/exploring-astronomy-with-wolfram-mathematica\/","url_meta":{"origin":4322,"position":5},"title":"Exploring Astronomy with Wolfram Mathematica","author":"admin","date":"April 22, 2026","format":false,"excerpt":"As a student of astrology and who has written software for Krishnamurti Padhdhati (KP) System, I am fascinated by astronomy. We all know that there is a deep computational\u00a0connection between astronomy and astrology. Every astrological system \u2014 Western tropical, Vedic sidereal, KP, Jaimini, Chinese \u2014 is ultimately dependent on an\u2026","rel":"","context":"In &quot;Mathematica&quot;","block_context":{"text":"Mathematica","link":"https:\/\/www.rangakrish.com\/index.php\/category\/mathematica\/"},"img":{"alt_text":"Planetary Positions","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/04\/position-example-300x232.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/04\/position-example-300x232.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2026\/04\/position-example-300x232.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/4322","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=4322"}],"version-history":[{"count":2,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/4322\/revisions"}],"predecessor-version":[{"id":4331,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/4322\/revisions\/4331"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=4322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=4322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=4322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}