06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 1. INTRODUCTION 13<br />

In [14]: x[4]<br />

Out[14]: 40<br />

In [15]: length(x)<br />

Out[15]: 6<br />

Broadcast<strong>in</strong>g syntax (or dot syntax) is an easy way to apply a function to an array:<br />

In [16]: x=[1, 2, 3]<br />

Out[16]: 3-element Array{Int64,1}:<br />

1<br />

2<br />

3<br />

In [17]: s<strong>in</strong>.(x)<br />

Out[17]: 3-element Array{Float64,1}:<br />

0.8414709848078965<br />

0.9092974268256817<br />

0.1411200080598672<br />

Plott<strong>in</strong>g<br />

There are several packages for plott<strong>in</strong>g functions and we will use the PyPlot package.<br />

To <strong>in</strong>stall the package, open a <strong>Julia</strong> term<strong>in</strong>al. Here is how it looks like:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!