diff --git a/01_Coursera_1.ipynb b/01_Coursera_1.ipynb new file mode 100644 index 0000000..7438f8d --- /dev/null +++ b/01_Coursera_1.ipynb @@ -0,0 +1,164 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n" + ] + } + ], + "source": [ + "println(\"Hello World!\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "14" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5+9 # 14" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello! My word! Hello! My word! \n" + ] + } + ], + "source": [ + "println((\"Hello!\" * \" My word! \")^2)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "search: \u001b[0m\u001b[1mp\u001b[22m\u001b[0m\u001b[1mr\u001b[22m\u001b[0m\u001b[1mi\u001b[22m\u001b[0m\u001b[1mn\u001b[22m\u001b[0m\u001b[1mt\u001b[22m\u001b[0m\u001b[1ml\u001b[22m\u001b[0m\u001b[1mn\u001b[22m \u001b[0m\u001b[1mp\u001b[22m\u001b[0m\u001b[1mr\u001b[22m\u001b[0m\u001b[1mi\u001b[22m\u001b[0m\u001b[1mn\u001b[22m\u001b[0m\u001b[1mt\u001b[22msty\u001b[0m\u001b[1ml\u001b[22med \u001b[0m\u001b[1mp\u001b[22m\u001b[0m\u001b[1mr\u001b[22m\u001b[0m\u001b[1mi\u001b[22m\u001b[0m\u001b[1mn\u001b[22m\u001b[0m\u001b[1mt\u001b[22m s\u001b[0m\u001b[1mp\u001b[22m\u001b[0m\u001b[1mr\u001b[22m\u001b[0m\u001b[1mi\u001b[22m\u001b[0m\u001b[1mn\u001b[22m\u001b[0m\u001b[1mt\u001b[22m is\u001b[0m\u001b[1mp\u001b[22m\u001b[0m\u001b[1mr\u001b[22m\u001b[0m\u001b[1mi\u001b[22m\u001b[0m\u001b[1mn\u001b[22m\u001b[0m\u001b[1mt\u001b[22m\n", + "\n" + ] + }, + { + "data": { + "text/latex": [ + "\\begin{verbatim}\n", + "println([io::IO], xs...)\n", + "\\end{verbatim}\n", + "Print (using \\href{@ref}{\\texttt{print}}) \\texttt{xs} followed by a newline. If \\texttt{io} is not supplied, prints to \\href{@ref}{\\texttt{stdout}}.\n", + "\n", + "\\section{Examples}\n", + "\\begin{verbatim}\n", + "julia> println(\"Hello, world\")\n", + "Hello, world\n", + "\n", + "julia> io = IOBuffer();\n", + "\n", + "julia> println(io, \"Hello, world\")\n", + "\n", + "julia> String(take!(io))\n", + "\"Hello, world\\n\"\n", + "\\end{verbatim}\n" + ], + "text/markdown": [ + "```\n", + "println([io::IO], xs...)\n", + "```\n", + "\n", + "Print (using [`print`](@ref)) `xs` followed by a newline. If `io` is not supplied, prints to [`stdout`](@ref).\n", + "\n", + "# Examples\n", + "\n", + "```jldoctest\n", + "julia> println(\"Hello, world\")\n", + "Hello, world\n", + "\n", + "julia> io = IOBuffer();\n", + "\n", + "julia> println(io, \"Hello, world\")\n", + "\n", + "julia> String(take!(io))\n", + "\"Hello, world\\n\"\n", + "```\n" + ], + "text/plain": [ + "\u001b[36m println([io::IO], xs...)\u001b[39m\n", + "\n", + " Print (using \u001b[36mprint\u001b[39m) \u001b[36mxs\u001b[39m followed by a newline. If \u001b[36mio\u001b[39m is not supplied, prints\n", + " to \u001b[36mstdout\u001b[39m.\n", + "\n", + "\u001b[1m Examples\u001b[22m\n", + "\u001b[1m ≡≡≡≡≡≡≡≡≡≡\u001b[22m\n", + "\n", + "\u001b[36m julia> println(\"Hello, world\")\u001b[39m\n", + "\u001b[36m Hello, world\u001b[39m\n", + "\u001b[36m \u001b[39m\n", + "\u001b[36m julia> io = IOBuffer();\u001b[39m\n", + "\u001b[36m \u001b[39m\n", + "\u001b[36m julia> println(io, \"Hello, world\")\u001b[39m\n", + "\u001b[36m \u001b[39m\n", + "\u001b[36m julia> String(take!(io))\u001b[39m\n", + "\u001b[36m \"Hello, world\\n\"\u001b[39m" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "?println" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.2.0", + "language": "julia", + "name": "julia-1.2" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.2.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/01_Coursera_2.ipynb b/01_Coursera_2.ipynb new file mode 100644 index 0000000..5095a06 --- /dev/null +++ b/01_Coursera_2.ipynb @@ -0,0 +1,26 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.2.0", + "language": "julia", + "name": "julia-1.2" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.2.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/02_Coursera_1.ipynb b/02_Coursera_1.ipynb new file mode 100644 index 0000000..556c17a --- /dev/null +++ b/02_Coursera_1.ipynb @@ -0,0 +1,406 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-2" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1-2+3-4" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5//4" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1//2+3//4" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.05" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1/(2+3)/4" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4//11" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1//(2+(3//4))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7//8" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(1//2+3)//4" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "!true" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "!false" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "true && true" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "true && false" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "false || true" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "84.0" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "5040 / 60" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "11" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "8+2*3-3" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2^2+6" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "0-6+2^4" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "2*3+2^1+1" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1+3<5||2+2<1" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "3 & 5 > 0 " + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "8 & 5 > 0" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "1 + (2 - 5) - 2 == 0" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.2.0", + "language": "julia", + "name": "julia-1.2" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.2.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/03_Coursera_1.ipynb b/03_Coursera_1.ipynb new file mode 100644 index 0000000..d32e44a --- /dev/null +++ b/03_Coursera_1.ipynb @@ -0,0 +1,820 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "length(bitstring(parse(Int8,\"4\")))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "length(bitstring(Int8(4)))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Int8" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(Int8(3))" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"11001110101100010000000000000000\"" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bitstring('α')" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2-element Array{Int64,1}:\n", + " 0\n", + " 1" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "digits(10, base = 10)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4-element Array{Int64,1}:\n", + " 0\n", + " 1\n", + " 0\n", + " 1" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "digits(10, base = 2)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(2) == typeof(4.0)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 4695258384\n", + " 4695258416\n", + " 4695258448" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Array{Int64}(undef,3)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{String,1}:\n", + " #undef\n", + " #undef\n", + " #undef" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Array{String}(undef,3)" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\"Hello World!\"" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "greeting = \"Hello World!\"" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello World!\n" + ] + } + ], + "source": [ + "println(greeting)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 1\n", + " 2\n", + " 3" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = [1,2,3]" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 1\n", + " 2\n", + " 3" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b = a" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b[2] = 5" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 1\n", + " 5\n", + " 3" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "7" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a[1] = 7" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 7\n", + " 5\n", + " 3" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 7\n", + " 5\n", + " 3" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c = a[:]" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "9" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a[3] = 9" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 7\n", + " 5\n", + " 3" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3-element Array{Int64,1}:\n", + " 7\n", + " 5\n", + " 9" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2×3 Array{Integer,2}:\n", + " #undef #undef #undef\n", + " #undef #undef #undef" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "abstypevariable = Array{Integer}(undef,2,3)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Array{Integer,2}" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(abstypevariable)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "ename": "UndefRefError", + "evalue": "UndefRefError: access to undefined reference", + "output_type": "error", + "traceback": [ + "UndefRefError: access to undefined reference", + "", + "Stacktrace:", + " [1] getindex(::Array{Integer,2}, ::Int64, ::Int64) at ./array.jl:729", + " [2] top-level scope at In[35]:1" + ] + } + ], + "source": [ + "abstypevariable[2,1]" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "length(abstypevariable)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(2, 3)" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "size(abstypevariable)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(3,)" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "size([1,2,3])" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "abstypevariable[1,1] = 1" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5.0" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "abstypevariable[1,2] = 5.0 #5.3 not possible" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2×3 Array{Integer,2}:\n", + " 1 5 #undef\n", + " #undef #undef #undef" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "abstypevariable" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "ename": "MethodError", + "evalue": "MethodError: Cannot `convert` an object of type String to an object of type Integer\nClosest candidates are:\n convert(::Type{T<:Number}, !Matched::T<:Number) where T<:Number at number.jl:6\n convert(::Type{T<:Number}, !Matched::Number) where T<:Number at number.jl:7\n convert(::Type{T<:Integer}, !Matched::Ptr) where T<:Integer at pointer.jl:23\n ...", + "output_type": "error", + "traceback": [ + "MethodError: Cannot `convert` an object of type String to an object of type Integer\nClosest candidates are:\n convert(::Type{T<:Number}, !Matched::T<:Number) where T<:Number at number.jl:6\n convert(::Type{T<:Number}, !Matched::Number) where T<:Number at number.jl:7\n convert(::Type{T<:Integer}, !Matched::Ptr) where T<:Integer at pointer.jl:23\n ...", + "", + "Stacktrace:", + " [1] setindex!(::Array{Integer,2}, ::String, ::Int64, ::Int64) at ./array.jl:768", + " [2] top-level scope at In[46]:1" + ] + } + ], + "source": [ + "abstypevariable[2,2] = \"stringystringstr\"" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2×3 Array{Int64,2}:\n", + " 4679027904 4583513520 -1\n", + " 4661545168 1 4311744769" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "arbconcretevariable = Array{Int64}(undef,2,3)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'c': ASCII/Unicode U+0063 (category Ll: Letter, lowercase)" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Cake = 'c'" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "false" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "'a' === \"a\"" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3×2 Array{Integer,2}:\n", + " #undef #undef\n", + " #undef #undef\n", + " #undef #undef" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a = Array{Integer,2}(undef, 3, 2)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "11×12 Array{Int64,2}:\n", + " 4684904288 4671225872 4671226928 … 4671236288 4671236816 4671237344\n", + " 4684904336 4671225920 4671226976 4671236336 4671236864 4671237392\n", + " 4684904384 4671225968 4671227024 4671236384 4671236912 4671237440\n", + " 4684904432 4671226016 4671227504 4671236432 4671236960 4671237488\n", + " 4684904480 4671226064 4671227552 4671236480 4671237008 4671237536\n", + " 4684904528 4671226112 4671227600 … 4671236528 4671237056 4671237584\n", + " 4684904576 4671226160 4671227984 4671236576 4671237104 4671237680\n", + " 4684904624 4671226208 4671228032 4671236624 4671237152 4671237728\n", + " 4684904672 4671226448 4671228080 4671236672 4671237200 4671237776\n", + " 4684904720 4671226496 4671228464 4671236720 4671237248 4671237824\n", + " 4671176608 4671226544 4671228656 … 4671236768 4671237296 4671238352" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = Array{Int64}(undef,11, 12) \n" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Array{Int64,2}" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(x)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.2.0", + "language": "julia", + "name": "julia-1.2" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.2.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/04_Coursera_1.ipynb b/04_Coursera_1.ipynb new file mode 100644 index 0000000..3d6df75 --- /dev/null +++ b/04_Coursera_1.ipynb @@ -0,0 +1,1102 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hello world\n" + ] + } + ], + "source": [ + "greeting = \"Hello world\"\n", + "println(greeting)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0.9800665778412416, 2.302585092994046, 1.22)" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a,b,c = cos(0.2), log(10), abs(-1.22)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.9800665778412416" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "a" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "search: \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22m \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22mh \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22md \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22mc \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22mpi a\u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22m a\u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22mh a\u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22md sin\u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22m \u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22mn\u001b[0m\u001b[1ms\u001b[22mt \u001b[0m\u001b[1mc\u001b[22ml\u001b[0m\u001b[1mo\u001b[22m\u001b[0m\u001b[1ms\u001b[22me is\u001b[0m\u001b[1mc\u001b[22m\u001b[0m\u001b[1mo\u001b[22mn\u001b[0m\u001b[1ms\u001b[22mt\n", + "\n" + ] + }, + { + "data": { + "text/latex": [ + "\\begin{verbatim}\n", + "cos(x)\n", + "\\end{verbatim}\n", + "Compute cosine of \\texttt{x}, where \\texttt{x} is in radians.\n", + "\n", + "\\rule{\\textwidth}{1pt}\n", + "\\begin{verbatim}\n", + "cos(A::AbstractMatrix)\n", + "\\end{verbatim}\n", + "Compute the matrix cosine of a square matrix \\texttt{A}.\n", + "\n", + "If \\texttt{A} is symmetric or Hermitian, its eigendecomposition (\\href{@ref}{\\texttt{eigen}}) is used to compute the cosine. Otherwise, the cosine is determined by calling \\href{@ref}{\\texttt{exp}}.\n", + "\n", + "\\section{Examples}\n", + "\\begin{verbatim}\n", + "julia> cos(fill(1.0, (2,2)))\n", + "2×2 Array{Float64,2}:\n", + " 0.291927 -0.708073\n", + " -0.708073 0.291927\n", + "\\end{verbatim}\n" + ], + "text/markdown": [ + "```\n", + "cos(x)\n", + "```\n", + "\n", + "Compute cosine of `x`, where `x` is in radians.\n", + "\n", + "---\n", + "\n", + "```\n", + "cos(A::AbstractMatrix)\n", + "```\n", + "\n", + "Compute the matrix cosine of a square matrix `A`.\n", + "\n", + "If `A` is symmetric or Hermitian, its eigendecomposition ([`eigen`](@ref)) is used to compute the cosine. Otherwise, the cosine is determined by calling [`exp`](@ref).\n", + "\n", + "# Examples\n", + "\n", + "```jldoctest\n", + "julia> cos(fill(1.0, (2,2)))\n", + "2×2 Array{Float64,2}:\n", + " 0.291927 -0.708073\n", + " -0.708073 0.291927\n", + "```\n" + ], + "text/plain": [ + "\u001b[36m cos(x)\u001b[39m\n", + "\n", + " Compute cosine of \u001b[36mx\u001b[39m, where \u001b[36mx\u001b[39m is in radians.\n", + "\n", + " ────────────────────────────────────────────────────────────────────────────\n", + "\n", + "\u001b[36m cos(A::AbstractMatrix)\u001b[39m\n", + "\n", + " Compute the matrix cosine of a square matrix \u001b[36mA\u001b[39m.\n", + "\n", + " If \u001b[36mA\u001b[39m is symmetric or Hermitian, its eigendecomposition (\u001b[36meigen\u001b[39m) is used to\n", + " compute the cosine. Otherwise, the cosine is determined by calling \u001b[36mexp\u001b[39m.\n", + "\n", + "\u001b[1m Examples\u001b[22m\n", + "\u001b[1m ≡≡≡≡≡≡≡≡≡≡\u001b[22m\n", + "\n", + "\u001b[36m julia> cos(fill(1.0, (2,2)))\u001b[39m\n", + "\u001b[36m 2×2 Array{Float64,2}:\u001b[39m\n", + "\u001b[36m 0.291927 -0.708073\u001b[39m\n", + "\u001b[36m -0.708073 0.291927\u001b[39m" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "? cos" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.0" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cos(0)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-1.0" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cos(π)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6.123233995736766e-17" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cos(π/2)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Irrational{:π}" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(π)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "12 methods for generic function muladd: