Commit 3259b711 authored by Mark van Turnhout's avatar Mark van Turnhout
Browse files

checking the inverse matrix in the Java program

parents
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
*.sql
*.sqlite
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Linux git ignore
.*
!.gitignore
*~
##---------------------------------------------------
## Remove autosaves generated by the Matlab editor
## We have git for backups!
##---------------------------------------------------
# Windows default autosave extension
*.asv
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
*.mat
# Simulink Code Generation
slprj/
# Abaqus gitignore
*.rpy*
*.cae
*.rec
*.dat
*.msg
*.ipm
*.odb
*.prt
*.sim
*.jnl
*.sta
# LaTeX git ignore
*.acn
*.acr
*.alg
*.aux
*.bak
*.bbl
*.blg
*.dvi
*.dep
*.fls
*.fdb_latexmk
*.glg
*.glo
*.gls
*.idx
*.ilg
*.ind
*.ist
*.lof
*.log
*.lot
*.maf
*.mtc
*.mtc0
*.nav
*.nlo
*.out
*.pdfsync
*.ps
*.sav
*.snm
*.synctex.gz
*.toc
*.vrb
*.xdy
*.tdo
octave-workspace
# repo specific ignores
*.pdf
!pics/*.pdf
syms a b c d e f g h j cosx1 cosx2 cosx0 cosy1 cosy2 cosy0 cosz1 cosz2 cosz0 positive
% the matrix
Q = [a b c; d e f; g h j]
% its determinant
D = det(Q)
% its inverse
I = inv(Q)
% inverse multiplied by determinant
I*D
% the Java program
A = cosy1 - cosx1 * cosy0 / cosx0;
V = cosz1 - cosx1 * cosz0 / cosx0;
C = cosz2 - cosy2 * V / A + cosx2 * (V / A * cosy0 / cosx0 - cosz0 / cosx0);
q(3) = (-cosx2 / cosx0 - cosx2 / A * cosx1 / cosx0 * cosy0 / cosx0 + cosy2 / A * cosx1 / cosx0) / C;
q(2) = -q(3) * V / A - cosx1 / (cosx0 * A);
q(1) = 1.0 / cosx0 - q(2) * cosy0 / cosx0 - q(3) * cosz0 / cosx0;
q(6) = (-cosy2 / A + cosx2 / A * cosy0 / cosx0) / C;
q(5) = -q(6) * V / A + 1.0 / A;
q(4) = -q(5) * cosy0 / cosx0 - q(6) * cosz0 / cosx0;
q(9) = 1.0 / C;
q(8) = -q(9) * V / A;
q(7) = -q(8) * cosy0 / cosx0 - q(9) * cosz0 / cosx0;
% determinant?
d = cosx0*cosy1*cosz2 - cosx0*cosy2*cosz1 - cosx1*cosy0*cosz2 + cosx1*cosz0*cosy2 + cosy0*cosx2*cosz1 - cosx2*cosy1*cosz0;
pretty(simplify(q*d))
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment