{"id":139063,"date":"2022-05-18T11:20:03","date_gmt":"2022-05-18T15:20:03","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=139063"},"modified":"2022-11-21T09:54:38","modified_gmt":"2022-11-21T14:54:38","slug":"the-brass-tacks-of-julia-programming-part-i","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/","title":{"rendered":"The Brass Tacks of Julia Programming &#8211; Part I"},"content":{"rendered":"\n<p>This is my second article in the Julia programming series. In my previous blog, I introduced you to&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/julia-programming\/\">Julia programming<\/a>&nbsp;and discussed its origin and features. Here, I\u2019ll work with the basic syntax of Julia programming.<\/p>\n\n\n\n<p>I\u2019ve divided this article into the following sections:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Basic arithmetic operations<\/li><li>General operations<\/li><li>Strings<\/li><li>Data structures<\/li><li>Working with matrices<\/li><li>Loops<\/li><li>Conditional statements<\/li><li>Functions<\/li><li>Using R and Python code in Julia<\/li><li>Python vs Julia &#8211; Comparison of syntax for basic operations<\/li><\/ul>\n\n\n\n<p>Let&#8217;s start with the most traditional method of learning any new programming language.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"331\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_helloWorld-1-quantinsti.jpg\" alt=\"\" class=\"wp-image-139076 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_helloWorld-1-quantinsti.jpg 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_helloWorld-1-quantinsti-700x322.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_helloWorld-1-quantinsti-300x138.jpg 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/331;\" \/><\/figure>\n\n\n\n<p>For the first few code snippets, I\u2019ve deliberately used screen grabs from my Julia console so that you get a better feel of it.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic-arithmetic-operations\">Basic arithmetic operations<\/h2>\n\n\n\n<p>Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"148\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_sum-quantinsti.jpg\" alt=\"\" class=\"wp-image-139082 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_sum-quantinsti.jpg 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_sum-quantinsti-700x144.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia_sum-quantinsti-300x62.jpg 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/148;\" \/><\/figure>\n\n\n\n<p>Here\u2019s how you can write complex numbers and do basic operations on them.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"720\" height=\"151\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia__complexNumbers.jpg\" alt=\"\" class=\"wp-image-139085 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia__complexNumbers.jpg 720w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia__complexNumbers-700x147.jpg 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/julia__complexNumbers-300x63.jpg 300w\" data-sizes=\"(max-width: 720px) 100vw, 720px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 720px; aspect-ratio: 720\/151;\" \/><\/figure>\n\n\n\n<p>When you add a floating-point number to an integer, it returns a floating-point number.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> ## Returns a float \n1.0 + 2 <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: 3.0\n<\/code><\/pre>\n\n\n\n<p>Let\u2019s look at division.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## Division \n1\/2\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: 0.5\n<\/code><\/pre>\n\n\n\n<p>Exponentiations can be done using the \u201c^\u201d symbol.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>5^2\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: 25\n<\/code><\/pre>\n\n\n\n<p>Julia can do operations on fractional numbers as well.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## Fractional numbers\n1\/\/2\n## Adding fractional numbers\n1\/\/12 + 3\/\/29<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code> Output: 65\/\/348\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"general-operations\">General operations<\/h2>\n\n\n\n<p>Looking at the type of a variable is crucial while programming. Here\u2019s how it can be done in Julia.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>typeof(1)\ntypeof(1.0)\ntypeof('a')\ntypeof(\"Test\")<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\nInt64\nFloat64\nChar\nString<\/code><\/pre>\n\n\n\n<p>An important thing to note here is that characters are defined using single quotes while strings are defined using double quotes. A string in single quotes will return an error.<\/p>\n\n\n\n<p>Let\u2019s look at how to convert one variable type into another.<\/p>\n\n\n\n<p>Converting a floating-point number into an integer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Method 1\nconvert(Int32, 1.0)\n\n# Method 2\nInt64(4.0)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n1\n4\n<\/code><\/pre>\n\n\n\n<p>The following example shows the method to comment multiple lines of code in Julia.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#=\nYour comments here\nYour comments here\nYour comments here\n=#<\/code><\/pre>\n\n\n\n<p>Single line comment can be written followed by \u201c#\u201d.<\/p>\n\n\n\n<p>When you get stuck somewhere, the documentation can come in handy. Here\u2019s how you can find out details of any function &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>? log\nOutput: log(b,x) Compute the base blogarithm of x. Throws DomainError for negative Real arguments.\nExamples\njulia&gt; log(4,8)\n1.5\njulia&gt; log(4,2)\n0.5<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"strings\">Strings<\/h2>\n\n\n\n<p>Now, let\u2019s see how to use strings in Julia.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \"This is a string.\"\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: This is a string.\n<\/code><\/pre>\n\n\n\n<p>Strings can be defined using &#8220;&#8221; or &#8220;&#8221;&#8221; &#8220;&#8221;&#8221;. The use case for the second version would be when you need to use&nbsp;&nbsp;&#8221; inside your string. For example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> \"\"\" This is the use case for \"triple-quote\" string definition method.\"\"\" \n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: This is the use case for \\\"triple-quote\\\" string definition method.\n<\/code><\/pre>\n\n\n\n<p>Here\u2019s how we can use string-like variables.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>variable = \"Julia\"\n\"This is how variables can be used inside strings in $variable.\"\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: This is how variables can be used inside strings in Julia.\n<\/code><\/pre>\n\n\n\n<p>Exponentiation can be performed on strings as well. Here\u2019s an example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> variable^3 \n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: JuliaJuliaJulia\n<\/code><\/pre>\n\n\n\n<p>Let\u2019s move on to the methods of manipulating strings. There are multiple ways of doing the same thing. Let\u2019s look at how we can add 2 strings.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Method 1\n\nstring(\"This is how we\", \" merge strings\")\nstring(\"This is how we merge \", 2,  \" strings with a number in-between\")\n\n\n# Method 2\n\nvar_1 = \"This is method 2\"\nvar_2 = \"of concatenating strings in Julia\"\nvar_1 * \" \" * var_2\n\n# Method 3\n\nvar_3 = \"This is method 3\"\n\"$var_3 $var_2\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: \nThis is how we merge strings \nThis is how we merge 2 strings with a number in-between \nThis is method 2 of concatenating strings in Julia \nThis is method 3 of concatenating strings in Julia<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"data-structures\">Data structures<\/h2>\n\n\n\n<p>Data structures form the building blocks of any programming language. They provide different ways to organize the data in order to use them efficiently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tuples\">Tuples<\/h3>\n\n\n\n<p>Tuples are a type of data structure that can\u2019t be modified. Here\u2019s how you can define a tuple.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuples = (1, 2, 3)\ntypeof(tuples)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n(1, 2, 3)\nTuple{Int64, Int64, Int64}<\/code><\/pre>\n\n\n\n<p>Indexing in Julia starts at 1. Here\u2019s how you can access the first and the last element of any data structure in Julia.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Accessing the first element\ntuples&#91;1]\n\n# Accessing the last element\ntuples&#91;end]\n\n# &#91;10] &#91;11] Negative indexing doesn't work in Julia\ntuples&#91;-1]\n\n# Tuples can't be modified\npush!(tuples, 2)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n1\n3\n\nBoundsError: attempt to access Tuple{Int64, Int64, Int64} at index &#91;-1]\nStacktrace:\n&#91;1] getindex(t::Tuple, i::Int64)\n@ Base .\/tuple.jl:29\n&#91;2] top-level scope\n@ In&#91;30]:2\n&#91;3] eval\n@ .\/boot.jl:360 &#91;inlined]\n&#91;4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)\n@ Base .\/loading.jl:1116\nMethodError: no method matching push!(::Tuple{Int64, Int64, Int64}, ::Int64)\nClosest candidates are:\npush!(::Any, ::Any, ::Any) at abstractarray.jl:2387\npush!(::Any, ::Any, ::Any, ::Any...) at abstractarray.jl:2388\npush!(::AbstractChannel, ::Any) at channels.jl:10\n...\nStacktrace:\n&#91;1] top-level scope\n@ In&#91;33]:2\n&#91;2] eval\n@ .\/boot.jl:360 &#91;inlined]<\/code><\/pre>\n\n\n\n<p>Here\u2019s how you can merge tuples &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Concatenating tuples\n(tuples..., tuples...)\n\n# This method of adding \"...\" after any variable can be used to merge any two datatypes<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n(1, 2, 3, 1, 2, 3)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"vectors\">Vectors<\/h3>\n\n\n\n<p>Vectors are a type of data structure that can be modified. Here\u2019s how you can work with vectors.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Method 1\nvector = &#91;8, 1, 9, 12]\n\n# Method 2\nvector_2 = &#91;8 ; 1 ; 9 ; 12]<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n4-element Vector{Int64}:\n\n8\n1\n9\n12<\/code><\/pre>\n\n\n\n<p>Here\u2019s how mutation can be done in Julia. Using the \u201c!\u201d symbol, write the changes to the original variable. This is equivalent to \u201cinplace=True\u201d in Python.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Mutation in Julia\nsort(vector)\n\n# The original vector doesn't change\nsort!(vector)\n\n# The original vector changes\nvector<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n4-element Vector{Int64}:\n1\n8\n9\n12<\/code><\/pre>\n\n\n\n<p>To perform an element-wise operation, use the &#8220;.&#8221; operator.<\/p>\n\n\n\n<p>vector + 1 # This doesn&#8217;t work<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vector .+ 1\n\n# Adding vectors\nvector + vector_2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output: \n\n4-element Vector{Int64}:\n2\n9\n10\n13\n\n4-element Vector{Int64}:\n2\n16\n18\n24<\/code><\/pre>\n\n\n\n<p>Now, vectors can contain variables of different data types. Here\u2019s an example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vector_3 = &#91;1, 5, \"foo\", 1+3im]\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n4-element Vector{Any}:\n1\n5\n\"foo\"\n1 + 3im<\/code><\/pre>\n\n\n\n<p>Notice that the vector type is assumed to be &#8220;Any&#8221; as there are variables of different data types.<\/p>\n\n\n\n<p>Let\u2019s look at the method of generating a sequence of numbers. Here\u2019s an example of generating a sequence from 1 to 10 with a spacing of 2.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>seq = &#91;1:2:10;]\n<\/code><\/pre>\n\n\n\n<p>Here\u2019s what the output looks like.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\n5-element Vector{Int64}:\n1\n3\n5\n7\n9<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"dictionaries\">Dictionaries<\/h3>\n\n\n\n<p>Now we move on to creating dictionaries. Dictionaries are used in a programming language to store information about a unique variable.<\/p>\n\n\n\n<p>Just as each word in a human language dictionary has an associated meaning, in Julia we have each key that has a value associated with it.This can be useful in cases where you want to look up values associated with a particular key.<\/p>\n\n\n\n<p>Here\u2019s how you can create a dictionary in Julia.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dictionary = Dict('A' =&gt; 1, 'B' =&gt; 2)\n<\/code><\/pre>\n\n\n\n<p>This is what the output looks like &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\nDict{Char, Int64} with 2 entries:\n'A' =&gt; 1\n'B' =&gt; 2<\/code><\/pre>\n\n\n\n<p>Now that we have created a dictionary, we would like to access various elements of it. Here\u2019s how we can do it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Accessing the keys\nkeys(dictionary)\n\n# Accessing the values associated with each key\nvalues(dictionary)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\nKeySet for a Dict{Char, Int64} with 2 entries. Keys:\n'A'\n'B'\n\nValueIterator for a Dict{Char, Int64} with 2 entries. Values:\n1\n2<\/code><\/pre>\n\n\n\n<p>Let\u2019s add a new entry to the dictionary.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Adding a new entry\n\nmerge!(dictionary, Dict('J' =&gt; 23))<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\nDict{Char, Int64} with 3 entries:\n'J' =&gt; 23\n'A' =&gt; 1\n'B' =&gt; 2<\/code><\/pre>\n\n\n\n<p>Notice that the \u201c!\u201d symbol makes the change permanent.<\/p>\n\n\n\n<p>Let\u2019s remove an entry now.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>## Removing an entry permanently from a dictionary\npop!(dictionary, 'J')\n\ndictionary<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Output:\n\nDict{Char, Int64} with 2 entries:\n'A' =&gt; 1\n'B' =&gt; 2<\/code><\/pre>\n\n\n\n<p><em>Stay tuned for the next installment in which Anshul Tayal will discuss working with matrices.<\/em><\/p>\n\n\n\n<p><em>Visit QuantInsti for additional insight on this article: <a href=\"https:\/\/blog.quantinsti.com\/julia-syntax\/\">https:\/\/blog.quantinsti.com\/julia-syntax\/<\/a><\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.<\/p>\n","protected":false},"author":726,"featured_media":139162,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,348,343,349,338,350,341,344,342],"tags":[806,11844,7560,11848,1006,923,11845,11846,11847],"contributors-categories":[13654],"class_list":{"0":"post-139063","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-julia-development","9":"category-programing-languages","10":"category-python-development","11":"category-ibkr-quant-news","12":"category-quant-asia-pacific","13":"category-quant-development","14":"category-quant-regions","15":"category-r-development","16":"tag-data-science","17":"tag-data-structures","18":"tag-data-visualization","19":"tag-dictionaries","20":"tag-fintech","21":"tag-julia-programming","22":"tag-strings","23":"tag-tuples","24":"tag-vectors","25":"contributors-categories-quantinsti"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>The Brass Tacks of Julia Programming &#8211; Part I<\/title>\n<meta name=\"description\" content=\"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/139063\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Brass Tacks of Julia Programming - Part I | IBKR Quant Blog\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-18T15:20:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-21T14:54:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Anshul Tayal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anshul Tayal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Anshul Tayal\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0245cc6a849222af1786952c9764fb11\"\n\t            },\n\t            \"headline\": \"The Brass Tacks of Julia Programming &#8211; Part I\",\n\t            \"datePublished\": \"2022-05-18T15:20:03+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:54:38+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/\"\n\t            },\n\t            \"wordCount\": 763,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/abstract-quant-blue-purple-nodes.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"Data structures\",\n\t                \"Data Visualization\",\n\t                \"Dictionaries\",\n\t                \"fintech\",\n\t                \"Julia programming\",\n\t                \"Strings\",\n\t                \"Tuples\",\n\t                \"Vectors\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Julia Development\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Asia Pacific\",\n\t                \"Quant Development\",\n\t                \"Quant Regions\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/\",\n\t            \"name\": \"The Brass Tacks of Julia Programming - Part I | IBKR Quant Blog\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/abstract-quant-blue-purple-nodes.jpg\",\n\t            \"datePublished\": \"2022-05-18T15:20:03+00:00\",\n\t            \"dateModified\": \"2022-11-21T14:54:38+00:00\",\n\t            \"description\": \"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-brass-tacks-of-julia-programming-part-i\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/abstract-quant-blue-purple-nodes.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/abstract-quant-blue-purple-nodes.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0245cc6a849222af1786952c9764fb11\",\n\t            \"name\": \"Anshul Tayal\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/anshultayal\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Brass Tacks of Julia Programming &#8211; Part I","description":"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/139063\/","og_locale":"en_US","og_type":"article","og_title":"The Brass Tacks of Julia Programming - Part I | IBKR Quant Blog","og_description":"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/","og_site_name":"IBKR Campus US","article_published_time":"2022-05-18T15:20:03+00:00","article_modified_time":"2022-11-21T14:54:38+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","type":"image\/jpeg"}],"author":"Anshul Tayal","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Anshul Tayal","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/"},"author":{"name":"Anshul Tayal","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0245cc6a849222af1786952c9764fb11"},"headline":"The Brass Tacks of Julia Programming &#8211; Part I","datePublished":"2022-05-18T15:20:03+00:00","dateModified":"2022-11-21T14:54:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/"},"wordCount":763,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","keywords":["Data Science","Data structures","Data Visualization","Dictionaries","fintech","Julia programming","Strings","Tuples","Vectors"],"articleSection":["Data Science","Julia Development","Programming Languages","Python Development","Quant","Quant Asia Pacific","Quant Development","Quant Regions","R Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/","name":"The Brass Tacks of Julia Programming - Part I | IBKR Quant Blog","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","datePublished":"2022-05-18T15:20:03+00:00","dateModified":"2022-11-21T14:54:38+00:00","description":"Let\u2019s do some basic arithmetic operations using Julia. There are multiple ways of performing the same operation.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-brass-tacks-of-julia-programming-part-i\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","width":1000,"height":563,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0245cc6a849222af1786952c9764fb11","name":"Anshul Tayal","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/anshultayal\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/05\/abstract-quant-blue-purple-nodes.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/139063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/726"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=139063"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/139063\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/139162"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=139063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=139063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=139063"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=139063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}