@@ -324,7 +324,7 @@ In code, this process might look like this:
324
324
{% sample lang="py" %}
325
325
[ import:13-19, lang:"python"] ( code/python/gaussian_elimination.py )
326
326
{% sample lang="rs" %}
327
- [ import:43-60 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
327
+ [ import:43-76 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
328
328
{% endmethod %}
329
329
330
330
As a note, if the highest value is $$ 0 $$ , the matrix is singular and the system has no single solution.
@@ -396,7 +396,7 @@ Here is what it might look like in code:
396
396
{% sample lang="py" %}
397
397
[ import:21-26, lang:"python"] ( code/python/gaussian_elimination.py )
398
398
{% sample lang="rs" %}
399
- [ import:62-71 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
399
+ [ import:62-75 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
400
400
{% endmethod %}
401
401
402
402
#### All together
@@ -409,8 +409,6 @@ When we put everything together, it looks like this:
409
409
[ import:15-48, lang:"c"] ( code/c/gaussian_elimination.c )
410
410
{% sample lang="cpp" %}
411
411
[ import:8-34, lang:"cpp"] ( code/c++/gaussian_elimination.cpp )
412
- {% sample lang="rs" %}
413
- [ import:41-78, lang:"rust"] ( code/rust/gaussian_elimination.rs )
414
412
{% sample lang="hs" %}
415
413
[ import:10-36, lang:"haskell"] ( code/haskell/gaussianElimination.hs )
416
414
{% sample lang="py" %}
@@ -421,6 +419,8 @@ When we put everything together, it looks like this:
421
419
[ import:1-38, lang:"javascript"] ( code/javascript/gaussian_elimination.js )
422
420
{% sample lang="go" %}
423
421
[ import:9-53, lang:"go"] ( code/go/gaussian_elimination.go )
422
+ {% sample lang="rs" %}
423
+ [ import:41-77, lang:"rust"] ( code/rust/gaussian_elimination.rs )
424
424
{% endmethod %}
425
425
426
426
To be clear: if the matrix is found to be singular during this process, the system of equations is either over- or under-determined and no general solution exists.
@@ -450,9 +450,6 @@ Here it is in code:
450
450
[ import:64-82, lang:"c"] ( code/c/gaussian_elimination.c )
451
451
{% sample lang="cpp" %}
452
452
[ import:36-54, lang:"cpp"] ( code/c++/gaussian_elimination.cpp )
453
- {% sample lang="rs" %}
454
- This code does not exist yet in rust, so here's Julia code (sorry for the inconvenience)
455
- [ import:67-93, lang:"julia"] ( code/julia/gaussian_elimination.jl )
456
453
{% sample lang="hs" %}
457
454
[ import:38-46, lang:"haskell"] ( code/haskell/gaussianElimination.hs )
458
455
{% sample lang="py" %}
@@ -463,6 +460,8 @@ This code does not exist yet in rust, so here's Julia code (sorry for the inconv
463
460
[ import:57-76, lang:"javascript"] ( code/javascript/gaussian_elimination.js )
464
461
{% sample lang="go" %}
465
462
[ import:55-82, lang:"go"] ( code/go/gaussian_elimination.go )
463
+ {% sample lang="rs" %}
464
+ [ import:79-96, lang:"rust"] ( code/rust/gaussian_elimination.rs )
466
465
{% endmethod %}
467
466
468
467
As a note: Gauss-Jordan elimination can also be used to find the inverse of a matrix by following the same procedure to generate a reduced row echelon matrix, but with an identity matrix on the other side instead of the right-hand side of each equation.
@@ -496,7 +495,7 @@ In code, it looks like this:
496
495
{% sample lang="cpp" %}
497
496
[ import:56-72, lang:"cpp"] ( code/c++/gaussian_elimination.cpp )
498
497
{% sample lang="rs" %}
499
- [ import:79-94 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
498
+ [ import:98-112 , lang:"rust"] ( code/rust/gaussian_elimination.rs )
500
499
{% sample lang="hs" %}
501
500
[ import:48-53, lang:"haskell"] ( code/haskell/gaussianElimination.hs )
502
501
{% sample lang="py" %}
@@ -523,7 +522,7 @@ That said, it is particularly interesting to see what happens as we plot our mat
523
522
<video width =" 560 " height =" 315 " autoplay controls loop >
524
523
<source src =" res/GE_vis.mp4 " type =" video/mp4 " >
525
524
Your browser does not support the video tag.
526
- </video >
525
+ </video >
527
526
</div >
528
527
529
528
As we can see in the above visualization, the planes wobble about in 3D until they reach row echelon form, where one plane is parallel to the $$ x $$ and $$ y $$ axes.
0 commit comments