Julia
Julia
Trishal Muthan April 2021
1 Introduction
Julia is an open-source, high-performance, high-level, and dynamically-typed programming language that is primarily used for statistical or numerical computing, data analysis, and data processing. As both a dynamically-typed and compiled language (as opposed to statically-typed or interpreted), it contains many of the useful features of some languages, such as C and C++'s powerful speed and performance and Python's ease of use, while leaving behind some of their worse qualities. Much like Python, it is very easy to learn and put to use. It was designed for parallel and distributed computing and is also interoperable with various other programming languages. It is overall an extremely useful language with many benefits and is a language you should consider for any future projects you might work on.
2 History
Julia was founded in 2009 by 4 people: Jeff Bezanson, Stefan Karpinski, Viral Shah, and Alan Edelman. It was later released in 2012. In a message given by the creators, they stated that they created Julia because they were "greedy". They were tired of the downfalls that came with languages like Matlab, Lisp, Python, Ruby, Perl, Mathematica, R, and C, and wanted a single language that would be good for scientific computing, machine learning, data mining,
1
large-scale linear algebra, parallel computing, and distributed computing. Julia would later expand to becoming open source. It is now used by many different companies for various purposes. A few of them are as follows: Amazon, Apple, Disney, Facebook, Google, IBM, Microsoft, NASA, Oracle, and Uber. In 2017, Julia had around 1 million downloads. Now, it has over 25 million, showcasing the extreme growth it has had
3 Setup
3.1 Download Julia
Julia is an entirely programming language like Java, Python, or C++. You can't install it via command line like a Python package. To install, visit the following link: Julia Download. Once there, find the appropriate version for your computer and hit install. Then finish installing on your computer. One thing to keep track of is the path. Copy this and save it somewhere. For some editors (including the one I'm working on, which I'll talk about shortly), you will need this path to set up Julia.
3.2 repl.it
If you are working on a school laptop, you might not be able to download editors like VSCode or Atom so a good online editor is repl.it. It has a built-in Julia REPL.
1. Make an account or sign in 2. Go to the home page 3. Click "See All Languages" under the "Create" section 4. Find "Julia" (in the "Practical" section) 5. Give the repl a name and open it 6. Once you have written code, just click the run button at the top to run You should be all set to start coding Julia with repl.it!
2
3.3 VSCode
VSCode is a very commonly used editor and is the one I personally use. It also offers a built in Julia REPL that you can use to run Julia code. Here's the download: VSCode Download
1. Go to the extension tab on the left side 2. Find and install the Julia extension 3. Go the extension's settings and under the environment path section,
paste in the path to your Julia executable. 4. Create a .jl file and hit Ctrl-F5 to run the whole file or Alt-Enter to run
in the REPL You should be all set to start coding Julia with VSCode!
3.4 Julia REPL
Another option is the Julia REPL which you should be able to access after installing Julia. I prefer using the VSCode built-in REPL when necessary but just know that this is an option if you prefer it or if your editor does not have this functionality. The Julia REPL is used very frequently by Julia developers and you should be sure to know how to use it.
4 Using Julia
3
4.1 Data Types
In Julia every element has a type. The type system is a sort of hierarchical structure: at the top of the tree there is the type Any, which means that every element belongs to it, then there are many other sub-types, for example Number which includes Real and Complex, and Real contains for example Int (integer) numbers and Float64 numbers. To determine the type of some variable or object, we can use the typeof() function.
>>>typeof(0.1) Float64 >>>typeof(42) Int64 >>>typeof("Code++") String Julia also offers a convert() function that should allow you to convert between data types, specifically numbers. If you want to convert between number and String, use the parse() function and the string() function. Note: Strings must be surrounded by "".
>>>convert(Float64, 3) 3.00
>>>convert(Int64, 3.00) 3
>>>parse(Int64, "4") 4
>>>string(4) "4"
4.2 Variables
Variables are fairly straight forward in Julia, they work very similarly to every other language. You don't need to list the type beforehand and no semicolons or anything are needed. One thing to keep in mind is the scope of variables. In things like loops, you might have to use the keyword global to access a variable declared outside the loop.
my_name = "Trishal" my_favourite_number = 7 my_favourite_decimal = 4.20
4.3 Arithmetic
Arithmetic is obviously a very key component of Julia, seeing that Julia is so often used for things like numerical computing. This is rightfully so, as Julia
4
offers some very unique features when it comes to arithmetic. Here are some of the operators used for primitive types. Note the description at the bottom which says 2x or 2(x+y) is treated as multiplication and the operator being used for powers! I won't cover all the specific arithmetic details here because they are EXTREMELY comprehensive. Here's a link to check it out: Arithmetic in Julia
4.4 Input/Output
Input and output is very basic in Julia and is very similar to languages like Python. To use formatted strings in Julia, use a $ along with the variable name. >> print("Hello, my name is Trishal") Hello, my name is Trishal >>name = readline() Hello, my name is Dan >>print(name) Hello, my name is Dan >>>name1 = "Shrey" >>>name2 = "Aryan" >>>print("Hello $name1 and $name2") Hello Shrey and Aryan
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- the julia express
- erik engheim accu
- numpy user guide scipy
- floating point typedefs having specified widths n1703
- numerical computing in python cornell university
- erik engheim
- an introduction to numpy and scipy ucsb college of engineering
- cs 649 intro to big data tools and methods spring semester 2022 doc
- package int64 universidad autónoma del estado de morelos
- just in time compilation washington state university