# R, Julia and MATLAB

> Three languages built for data, statistics and maths. How they work on a whole column of numbers at once, and why they count from 1.

**Course:** [Programming Languages](https://learn.benibix.com/learn/development-languages)  
**Time:** 11 min

**After this lesson you can:**

- Say what R, Julia and MATLAB are each used for
- Explain working on a whole list at once
- Remember that these languages count from 1

## Which languages are built for numbers and data

Some languages are built for maths, statistics and science. R is free and made for statistics and charts. MATLAB is a paid product for engineers working with tables of numbers. Julia is free and aims to be as easy as Python and nearly as fast as C. All three start counting their lists at 1, not 0.

Their big idea is working on a whole list of numbers at once. In these languages, prices * 2 doubles every price in the list in one step, with no loop. Code reads more like the maths on a page. It also runs fast, because the work is done by tuned code underneath.

R came out of a university in the 1990s, and people who work on stats love it. It has thousands of free add-ons for every kind of test and chart. Many research papers are written with R doing the numbers.

MATLAB has been sold since the 1980s, and many schools for engineers teach it. It comes with add-on kits for sound, pictures and control. The licence costs money. That is why many teams move to Python or Julia in time.

Julia appeared in 2012. It was built to end a common pain. People wrote a quick version in an easy language, then wrote it all again in C for speed. Julia builds each function the first time it runs, so the easy version is already fast.

Python does much of the same work with add-ons such as pandas. It is now the most common choice for data work. These three stay strong where they began. R leads in stats, MATLAB in building and testing machines, and Julia in heavy science.

The trap when moving between them is the starting index. data[1] is the first item in R, Julia and MATLAB, but the second item in Python. Code moved across without care is off by one.

```r
prices <- c(2.5, 4.0, 3.5)
prices * 2        # 5.0 8.0 7.0, no loop needed
mean(prices)      # 3.333333
prices[1]         # 2.5, R counts from 1
```
In R, one line doubles every price. The first item is prices[1], not prices[0].

![Two ways to double three prices. On the left, a loop that visits 2.5, 4.0 and 3.5 one at a time over three passes. On the right, one line, prices * 2, that turns the whole list into 5.0, 8.0 and 7.0 at once. A note below says the first price is prices[1] in R, Julia and MATLAB, and prices[0] in Python.](https://learn.benibix.com/diagrams/lang-vectors.svg)

### Example: Emma moves a model from MATLAB to Python

Emma ports a 600 line MATLAB model to Python to save on licences. Every result comes out shifted by one row.

Each data(1) in MATLAB should have become data[0] in Python. She fixes 37 places, and the results match to 6 decimal places.

**Words in this lesson:** [R (Programming Language)](https://learn.benibix.com/term/development/r-language), [Julia (Programming Language)](https://learn.benibix.com/term/development/julia), [MATLAB Language](https://learn.benibix.com/term/development/matlab)

**Question:** In R, Julia and MATLAB, what is the index of the first item in a list?

**Answer:** 1. These three count from 1, like maths books do. Python, JavaScript and C count from 0, which causes bugs when code is moved across.

---

Source: https://learn.benibix.com/learn/development-languages/r-julia-and-matlab
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
