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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 1. INTRODUCTION 17<br />

Out[23]: 3×3 Array{Float64,2}:<br />

-0.59693 0.227402 0.382604<br />

0.0805382 -0.824332 0.154728<br />

0.516392 0.59693 0.462668<br />

In [24]: A*<strong>in</strong>v(A)<br />

Out[24]: 3×3 Array{Float64,2}:<br />

1.0 -5.55112e-17 0.0<br />

1.38778e-16 1.0 1.249e-16<br />

-2.22045e-16 0.0 1.0<br />

Let’s try matrix vector multiplication. Def<strong>in</strong>e some vector v as:<br />

In [25]: v=[0 0 1]<br />

Out[25]: 1×3 Array{Int64,2}:<br />

0 0 1<br />

Now try A ∗ v to multiply them.<br />

In [26]: A*v<br />

DimensionMismatch("matrix A has dimensions (3,3), matrix B has dimensions (1,3)")<br />

Stacktrace:<br />

[1] _generic_matmatmul!(::Array{Float64,2}, ::Char, ::Char,<br />

::Array{Float64,2},::Array{Int64,2}) at /Users/osx/buildbot/slave/<br />

package_osx64/build/usr/share/julia/stdlib/v1.1/L<strong>in</strong>earAlgebra/src/matmul.jl:591<br />

[2] generic_matmatmul!(::Array{Float64,2}, ::Char, ::Char,<br />

::Array{Float64,2}, ::Array{Int64,2}) at /Users/osx/buildbot/slave/<br />

package_osx64/build/usr/share/julia/stdlib/v1.1/L<strong>in</strong>earAlgebra/src/matmul.jl:581<br />

[3] mul! at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/

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

Saved successfully!

Ooh no, something went wrong!