mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-24 09:24:32 +01:00
Update solutions notebook
This commit is contained in:
@@ -1,13 +1,90 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f48b9a60",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Solutions to Notebook Exercises\n",
|
||||
"\n",
|
||||
"## Julia Basics: Exercise 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a06fd02a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function ex1(a)\n",
|
||||
" j = 1\n",
|
||||
" m = a[j]\n",
|
||||
" for (i,ai) in enumerate(a)\n",
|
||||
" if m < ai\n",
|
||||
" m = ai\n",
|
||||
" j = i\n",
|
||||
" end\n",
|
||||
" end\n",
|
||||
" (m,j)\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "175b6c35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Julia Basics: Exercise 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "bb289acd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ex2(f,g) = x -> f(x) + g(x) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "86250e27",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Julia Basics: Exercise 3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "41b537ab",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function compute_values(n,max_iters)\n",
|
||||
" x = LinRange(-1.7,0.7,n)\n",
|
||||
" y = LinRange(-1.2,1.2,n)\n",
|
||||
" values = zeros(Int,n,n)\n",
|
||||
" for j in 1:n\n",
|
||||
" for i in 1:n\n",
|
||||
" values[i,j] = mandel(x[i],y[j],max_iters)\n",
|
||||
" end\n",
|
||||
" end\n",
|
||||
" values\n",
|
||||
"end\n",
|
||||
"values = compute_values(1000,10)\n",
|
||||
"using GLMakie\n",
|
||||
"heatmap(x,y,values)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d6d12733",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Solutions to Notebook Exercises\n",
|
||||
"\n",
|
||||
"## Matrix Multiplication : Implementation of Algorithm 3"
|
||||
"## Matrix Multiplication : Exercise 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user