{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Conditioning of linear systems" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2×2 Array{Float64,2}:\n", " 1.00001 1.0\n", " 1.0 1.00001" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A = [1+1e-5 1; 1 1+1e-5]" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2-element Array{Float64,1}:\n", " 1.1\n", " 1.0" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "b1 = [1,1]\n", "b2 = [1.1,1]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "using LinearAlgebra" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2-element Array{Float64,1}:\n", " 0.49999750001272647\n", " 0.4999975000122734" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x1 = A\\b1" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2-element Array{Float64,1}:\n", " 5000.524997344532\n", " -4999.475002594505" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x2 = A\\b2" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "200000.99999987945" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cond(A)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2.000010000025" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "norm(A)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "100000.00000064017" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "norm(inv(A))" ] } ], "metadata": { "@webio": { "lastCommId": "e9a93511962243029277753aee6f3162", "lastKernelId": "7f3ff2c0-b5d8-4598-8e5c-c670c0076c2f" }, "kernelspec": { "display_name": "Julia 1.5.3", "language": "julia", "name": "julia-1.5" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.5.3" } }, "nbformat": 4, "nbformat_minor": 2 }