1.6. USEFULLIBRARIES
81
julia> using Roots
julia> f(x) sin((x 1/4)) x^20 1
f (generic function with 1 method)
julia> newton(f, 0.2)
0.40829350427936706
TheNewton-Raphsonmethoduseslocalslopeinformation,whichcanleadtofailureofconver-
genceforsomeinitialconditions
julia> newton(f, 0.7)
-1.0022469256696989
Forthisreasonmostmodernsolversusemorerobust“hybridmethods”,asdoesRoots’sfzero()
function
julia> fzero(f, 01)
0.40829350427936706
Optimization Forconstrained,univariateminimizationausefuloptionisoptimize()fromthe
Optimpackage
ThisfunctiondefaultstoarobusthybridoptimizationroutinecalledBrent’smethod
julia> using Optim
julia> optimize(x -> x^2-1.01.0)
Results of Optimization Algorithm
* Algorithm: : Brent's s Method
* Search Interval: [-1.000000, 1.000000]
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
Pdf file compression - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
adjust size of pdf file; best pdf compressor online
Pdf file compression - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
reader pdf reduce file size; adjust file size of pdf
1.6. USEFULLIBRARIES
82
* Minimum: -0.000000
* Value of Function at Minimum: 0.000000
* Iterations: : 5
* Convergence: max(|x - x_upper|, |x - - x_lower|) ) <= 2*(1.5e-08*|x|+2.2e-16): true
* Objective Function Calls: 6
Forotheroptimizationroutines,includingleastsquaresandmultivariateoptimization,seethe
documentation
AnumberofalternativepackagesforoptimizationcanbefoundatJuliaOpt
OthersTopics
NumericalIntegration Thebaselibrarycontainsafunctioncalledquadgk()thatperformsGaus-
sianquadrature
julia> quadgk(x -> cos(x), -2pi2pi)
(5.644749237155177e-15,4.696156369056425e-22)
ThisisanadaptiveGauss-Kronrodintegrationtechniquethat’srelativelyaccuratefor smooth
functions
However,itsadaptiveimplementationmakesitslowandnotwellsuitedtoinnerloops
ForthiskindofintegrationyoucanusethequadratureroutinesfromQuantEcon
julia> using QuantEcon
julia> nodes, weights qnwlege(65-2pi2pi);
julia> integral do_quad(x -> cos(x), nodes, weights)
-2.912600716165059e-15
Let’stimethetwoimplementations
julia> @time quadgk(x -> cos(x), -2pi2pi)
elapsed time: : 2.732162971 1 seconds (984420160 bytes allocated, 40.55% gc time)
julia> @time do_quad(x -> cos(x), nodes, , weights)
elapsed time: : 0.002805691 1 seconds (1424 4 bytes s allocated)
Wegetsimilaraccuracywithaspeedupfactorapproachingthreeordersofmagnitude
Morenumericalintegration(anddifferentiation)routinescanbefoundinthepackageCalculus
LinearAlgebra Thestandardlibrarycontainsmanyusefulroutinesforlinearalgebra,inaddi-
tiontostandardfunctionssuchasdet(),inv(),eye(),etc.
Routinesareavailablefor
• Choleskyfactorization
• LUdecomposition
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
C# TIFF: How to Use C#.NET Code to Compress TIFF Image File
C# Demo Code for TIFF File Compression. Add references; RasterEdge.Imaging.Basic. dll. RasterEdge.Imaging.Basic.Codec.dll. RasterEdge.Imaging.Drawing.dll.
best pdf compressor online; change file size of pdf document
C# PDF Convert to Tiff SDK: Convert PDF to tiff images in C#.net
zoomValue, The magnification of the original PDF page size. compression, The target compression of the output tiff file, it is invalid for word file.
best way to compress pdf file; change font size fillable pdf
1.6. USEFULLIBRARIES
83
• Singularvaluedecomposition,
• Schurfactorization,etc.
Seehereforfurtherdetails
FurtherReading
The full l set t of libraries available e under the e Julia a packaging g system m can be browsed at
pkg.julialang.org
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
C# Create PDF from Tiff Library to convert tif images to PDF in C#
DocumentType.PDF. compression, The target compression of the output tiff file, it is invalid for pdf file. The type listed in the ImageCompress.cs.
adjust size of pdf; best pdf compression
C# Create PDF from PowerPoint Library to convert pptx, ppt to PDF
compression, The target compression of the output tiff file, it is invalid for pdf file. The type listed in the ImageCompress.cs. filePath, The output file path
pdf paper size; change font size in pdf
1.6. USEFULLIBRARIES
84
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
C# Create PDF from Excel Library to convert xlsx, xls to PDF in C#
compression, The target compression of the output tiff file, it is invalid for pdf file. The type listed in the ImageCompress.cs. filePath, The output file path
acrobat compress pdf; adjusting page size in pdf
C# Create PDF from Word Library to convert docx, doc to PDF in C#.
compression, The target compression of the output tiff file, it is invalid for pdf file. The type listed in the ImageCompress.cs. filePath, The output file path
pdf compressor; change font size in pdf comment box
CHAPTER
TWO
INTRODUCTORYAPPLICATIONS
Thissectionofthecoursecontainsintermediateandfoundationalapplications.
2.1 LinearAlgebra
Contents
• LinearAlgebra
– Overview
– Vectors
– Matrices
– SolvingSystemsofEquations
– EigenvaluesandEigenvectors
– FurtherTopics
Overview
Linearalgebraisoneofthemostusefulbranchesofappliedmathematicsforeconomiststoinvest
in
Forexample,manyappliedproblemsineconomicsandfinancerequirethesolutionofalinear
systemofequations,suchas
y
1
=ax
1
+bx
2
y
2
=cx
1
+dx
2
or,moregenerally,
y
1
=a
11
x
1
+a
12
x
2
++a
1k
x
k
.
.
.
y
n
=a
n1
x
1
+a
n2
x
2
++a
nk
x
k
(2.1)
Theobjectivehereistosolveforthe“unknowns”x
1
,...,x
k
givena
11
,...,a
nk
andy
1
,...,y
n
Whenconsideringsuchproblems,itisessentialthatwefirstconsideratleastsomeofthefollowing
questions
85
C# PDF Convert to Word SDK: Convert PDF to Word library in C#.net
zoomValue, The magnification of the original PDF page size. compression, The target compression of the output tiff file, it is invalid for word file.
change font size pdf form; can a pdf file be compressed
C# Create PDF from CSV to convert csv files to PDF in C#.net, ASP.
compression, The target compression of the output tiff file, it is invalid for pdf file. The type listed in the ImageCompress.cs. filePath, The output file path
change font size pdf comment box; change font size pdf fillable form
2.1. LINEARALGEBRA
86
• Doesasolutionactuallyexist?
• Arethereinfactmanysolutions,andifsohowshouldweinterpretthem?
• Ifnosolutionexists,isthereabest“approximate”solution?
• Ifasolutionexists,howshouldwecomputeit?
Thesearethekindsoftopicsaddressedbylinearalgebra
Inthislecturewewillcoverthebasicsoflinearandmatrix algebra, treatingboththeoryand
computation
Weadmitsomeoverlapwiththislecture,whereoperationsonJuliaarrayswerefirstexplained
Notethatthislectureismoretheoreticalthanmost,andcontainsbackgroundmaterialthatwillbe
usedinapplicationsaswegoalong
Vectors
Avectoroflengthnisjustasequence(orarray,ortuple)ofnnumbers,whichwewriteas=
(x
1
,...,x
n
)orx=[x
1
,...,x
n
]
Wewillwritethesesequenceseitherhorizontallyorverticallyasweplease
(Later,whenwewishtoperformcertainmatrixoperations,itwillbecomenecessarytodistinguish
betweenthetwo)
Thesetofalln-vectorsisdenotedbyR
n
Forexample,R
2
istheplane,andavectorinR
2
isjustapointintheplane
Traditionally,vectorsarerepresentedvisuallyasarrowsfromtheorigintothepoint
Thefollowingfigurerepresentsthreevectorsinthismanner
Ifyou’reinterested,theJuliacodeforproducingthisfigureishere
VectorOperations Thetwomostcommonoperatorsforvectorsareadditionandscalarmulti-
plication,whichwenowdescribe
Asamatterofdefinition,whenweaddtwovectors,weaddthemelementbyelement
x+y=
2
6
6
6
4
x
1
x
2
.
.
.
x
n
3
7
7
7
5
+
2
6
6
6
4
y
1
y
2
.
.
.
y
n
3
7
7
7
5
:=
2
6
6
6
4
x
1
+y
1
x
2
+y
2
.
.
.
x
n
+y
n
3
7
7
7
5
Scalarmultiplicationisanoperationthattakesanumbergandavectorxandproduces
gx:=
2
6
6
6
4
gx
1
gx
2
.
.
.
gx
n
3
7
7
7
5
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
2.1. LINEARALGEBRA
87
Scalarmultiplicationisillustratedinthenextfigure
InJulia,avectorcanberepresentedasaonedimensionalArray
JuliaArraysallowustoexpressscalarmultiplicationandadditionwithaverynaturalsyntax
julia> ones(3)
3-element Array{Float64,1}:
1.0
1.0
1.0
julia> [246]
3-element Array{Int64,1}:
2
4
6
julia> y
3-element Array{Float64,1}:
3.0
5.0
7.0
julia> 4# equivalent to 4 * x and 4 .* x
3-element Array{Float64,1}:
4.0
4.0
4.0
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
2.1. LINEARALGEBRA
88
InnerProductandNorm
Theinnerproductofvectorsx,y2R
n
isdefinedas
x
0
y:=
n
å
i=1
x
i
y
i
Twovectorsarecalledorthogonaliftheirinnerproductiszero
Thenormofavectorxrepresentsits“length”(i.e.,itsdistancefromthezerovector)andisdefined
as
kxk:=
p
x0x:=
n
å
i=1
x
2
i
!
1/2
Theexpressionkykisthoughtofasthedistancebetweenxandy
Continuingonfromthepreviousexample,theinnerproductandnormcanbecomputedasfol-
lows
julia> dot(x, y)
# Inner product of x and y
12.0
julia> sum(x .* y)
# Gives the same result
12.0
julia> norm(x)
# Norm of x
1.7320508075688772
julia> sqrt(sum(x.^2))
# Gives the same result
1.7320508075688772
Span GivenasetofvectorsA:=fa
1
,...,a
k
ginRn,it’snaturaltothinkaboutthenewvectors
wecancreatebyperforminglinearoperations
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
2.1. LINEARALGEBRA
89
NewvectorscreatedinthismannerarecalledlinearcombinationsofA
Inparticular,y2R
n
isalinearcombinationofA:=fa
1
,...,a
k
gif
y=b
1
a
1
++b
k
a
k
forsomescalarsb
1
,...,b
k
Inthiscontext,thevaluesb
1
,...,b
k
arecalledthecoefficientsofthelinearcombination
ThesetoflinearcombinationsofAiscalledthespanofA
ThenextfigureshowsthespanofA=fa
1
,a
2
ginR3
Thespanisa2dimensionalplanepassingthroughthesetwopointsandtheorigin
Thecodeforproducingthisfigurecanbefoundhere
Examples IfAcontainsonlyonevectora
1
2R
2
,thenitsspanisjustthescalarmultiplesofa
1
,
whichistheuniquelinepassingthroughbotha
1
andtheorigin
IfA=fe
1
,e
2
,e
3
gconsistsofthecanonicalbasisvectorsofR3,thatis
e
1
:=
2
4
1
0
0
3
5
e
2
:=
2
4
0
1
0
3
5
e
3
:=
2
4
0
0
1
3
5
thenthespanofAisallofR
3
,because,foranyx=(x
1
,x
2
,x
3
)2R3,wecanwrite
x=x
1
e
1
+x
2
e
2
+x
3
e
3
NowconsiderA
0
=fe
1
,e
2
,e
1
+e
2
g
Ify=(y
1
,y
2
,y
3
)isanylinearcombinationofthesevectors,theny
3
=0(checkit)
HenceA
0
failstospanallofR
3
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
2.1. LINEARALGEBRA
90
LinearIndependence Aswe’llsee,it’softendesirabletofindfamiliesofvectorswithrelatively
largespan,sothatmanyvectorscanbedescribedbylinearoperatorsonafewvectors
Theconditionweneedforasetofvectorstohavealargespaniswhat’scalledlinearindependence
Inparticular,acollectionofvectorsA:=fa
1
,...,a
k
ginRnissaidtobe
• linearlydependentifsomestrictsubsetofAhasthesamespanasA
• linearlyindependentifitisnotlinearlydependent
Putdifferently,asetofvectorsislinearlyindependentifnovectorisredundanttothespan,and
linearlydependentotherwise
Toillustratetheidea,recallthefigurethatshowedthespanofvectorsfa
1
,a
2
ginRasaplane
throughtheorigin
Ifwetakeathirdvectora
3
andformthesetfa
1
,a
2
,a
3
g,thissetwillbe
• linearlydependentifa
3
liesintheplane
• linearlyindependentotherwise
Asanotherillustrationoftheconcept,sinceR
n
canbespannedbynvectors(seethediscussionof
canonicalbasisvectorsabove),anycollectionofm>nvectorsinR
n
mustbelinearlydependent
ThefollowingstatementsareequivalenttolinearindependenceofA:=fa
1
,...,a
k
gRn
1. NovectorinAcanbeformedasalinearcombinationoftheotherelements
2. Ifb
1
a
1
+b
k
a
k
=0forscalarsb
1
,...,b
k
,thenb
1
==b
k
=0
(ThezerointhefirstexpressionistheoriginofR
n
)
UniqueRepresentations Anothernicethingaboutsetsoflinearlyindependentvectorsisthat
eachelementinthespanhasauniquerepresentationasalinearcombinationofthesevectors
Inotherwords,ifA:=fa
1
,...,a
k
gRnislinearlyindependentand
y=b
1
a
1
+b
k
a
k
thennoothercoefficientsequenceg
1
,...,g
k
willproducethesamevectory
Indeed,ifwealsohavey=g
1
a
1
+g
k
a
k
,then
(b
1
g
1
)a
1
++(b
k
g
k
)a
k
=0
Linearindependencenowimpliesg
i
=b
i
foralli
Matrices
Matricesareaneatwayoforganizingdataforuseinlinearoperations
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
Documents you may be interested
Documents you may be interested