Wednesday, October 20, 2010

solve linear equation system

To solve a linear equations system:

x+y+z=3
2x+2y+z=5
4x+8y-3z=9

linsolve is the function to use.

a=[1 1 1; 2 2 1; 4 8 -3];
b=[3;5;9];
linsolve(a,b)

Done!

Tuesday, October 19, 2010

roots function and solve functioin

Today I learned two methods to solve polynomial.Two functions, roots and solve can be used. For example, if I would like to solve the polynomial:

x^3+2*x^2-8*x+10=0

I can use:

r=roots([1 2 -8 10])

or:

solve('x^3+2*x^2-8*x+10')

However, the answers will be given in different form. The first one will give numerical values of the roots, like:
ans =

  -4.3605          
   1.1803 + 0.9488i
   1.1803 - 0.9488i

the latter one will give symbolic form answers:
ans =
 
-1/3*(215+3*2697^(1/2))^(1/3)-28/3/(215+3*2697^(1/2))^(1/3)-2/3
 1/6*(215+3*2697^(1/2))^(1/3)+14/3/(215+3*2697^(1/2))^(1/3)-2/3+1/2*i*3^(1/2)*(-1/3*(215+3*2697^(1/2))^(1/3)+28/3/(215+3*2697^(1/2))^(1/3))
 1/6*(215+3*2697^(1/2))^(1/3)+14/3/(215+3*2697^(1/2))^(1/3)-2/3-1/2*i*3^(1/2)*(-1/3*(215+3*2697^(1/2))^(1/3)+28/3/(215+3*2697^(1/2))^(1/3))
 
 

Thursday, October 7, 2010

I was using a lot of greek symbols in my Word document, and usually when I need one, I input a English letter, for example, "a", then highlight it and change the font to symbol. That way, I will have a "α" there. However, if someone changed the font of that letter, it won't show up correctly- a blank will be left there instead of the letter you want.

I did some research and found one way to solve this problem: Firstly type in the unicode for the greek letter, then press "Alt+X". The unicode will be turned into a greek letter, and changing the font will not cause any trouble. The greek letter will show up anyway, just look a little different when different font is used.

And here is the reference for the unicode. This is very cool!

0391 Α  GREEK CAPITAL LETTER ALPHA
0392 Β  GREEK CAPITAL LETTER BETA
0393 Γ  GREEK CAPITAL LETTER GAMMA
0394 Δ  GREEK CAPITAL LETTER DELTA
0395 Ε  GREEK CAPITAL LETTER EPSILON
0396 Ζ  GREEK CAPITAL LETTER ZETA
0397 Η  GREEK CAPITAL LETTER ETA
0398 Θ  GREEK CAPITAL LETTER THETA
0399 Ι  GREEK CAPITAL LETTER IOTA
039A Κ  GREEK CAPITAL LETTER KAPPA
039B Λ  GREEK CAPITAL LETTER LAMDA
039C Μ  GREEK CAPITAL LETTER MU
039D Ν  GREEK CAPITAL LETTER NU
039E Ξ  GREEK CAPITAL LETTER XI
039F Ο  GREEK CAPITAL LETTER OMICRON
03A0 Π  GREEK CAPITAL LETTER PI
03A1 Ρ  GREEK CAPITAL LETTER RHO
03A3 Σ  GREEK CAPITAL LETTER SIGMA
03A4 Τ  GREEK CAPITAL LETTER TAU
03A5 Υ  GREEK CAPITAL LETTER UPSILON
03A6 Φ  GREEK CAPITAL LETTER PHI
03A7 Χ  GREEK CAPITAL LETTER CHI
03A8 Ψ  GREEK CAPITAL LETTER PSI
03A9 Ω  GREEK CAPITAL LETTER OMEGA
03AA Ϊ  GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
03AB Ϋ  GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
03B1 α  GREEK SMALL LETTER ALPHA
03B2 β  GREEK SMALL LETTER BETA
03B3 γ  GREEK SMALL LETTER GAMMA
03B4 δ  GREEK SMALL LETTER DELTA
03B5 ε  GREEK SMALL LETTER EPSILON
03B6 ζ  GREEK SMALL LETTER ZETA
03B7 η  GREEK SMALL LETTER ETA
03B8 θ  GREEK SMALL LETTER THETA
03B9 ι  GREEK SMALL LETTER IOTA
03BA κ  GREEK SMALL LETTER KAPPA
03BB λ  GREEK SMALL LETTER LAMDA
03BC μ  GREEK SMALL LETTER MU
03BD ν  GREEK SMALL LETTER NU
03BE ξ  GREEK SMALL LETTER XI
03BF ο  GREEK SMALL LETTER OMICRON
03C0 π  GREEK SMALL LETTER PI
03C1 ρ  GREEK SMALL LETTER RHO
03C2 ς  GREEK SMALL LETTER FINAL SIGMA
03C3 σ  GREEK SMALL LETTER SIGMA
03C4 τ  GREEK SMALL LETTER TAU
03C5 υ  GREEK SMALL LETTER UPSILON
03C6 φ  GREEK SMALL LETTER PHI
03C7 χ  GREEK SMALL LETTER CHI
03C8 ψ  GREEK SMALL LETTER PSI
03C9 ω  GREEK SMALL LETTER OMEGA
03D1 ϑ  GREEK THETA SYMBOL
03D2 ϒ  GREEK UPSILON WITH HOOK SYMBOL
03D5 ϕ  GREEK PHI SYMBOL
03D6 ϖ  GREEK PI SYMBOL
03DC Ϝ   GREEK LETTER DIGAMMA
03F0 ϰ  GREEK KAPPA SYMBOL
03F1 ϱ   GREEK RHO SYMBOL

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...