Wednesday, April 20, 2011

Pre-Calc: Matrix Cross Multiplying (ijk)

This always takes some time to do on paper, and sometimes the results aren't always accurate. When you cross multiply, just type in your two 3D vectors and it works for you, giving you distance and the new vector at (i, j, k).

-- Matrix X Multiply --
:Prompt A,B,C
:Input "A2: ",D
:Input "B2: ",E
:Input "C2: ",F
:((BF)-(CE))→I
:((CD)-(AF))→J
:((AE)-(DB))→K
:I→L1(1)
:J→L1(2)
:K→L1(3)
:3→dim(L1)
:√(I2+J2+K2)→N
:Disp L1,N

Chemistry: Atoms, Mols, and Grams! Oh, my!

Converts all six ways. Just Pick your selection in the menu and instructions will appear.

-- Mols Conversion --
:Menu("Conversion","MOLS 2 GRAMS",1,"GRAMS 2 MOLS",2,"GRAMS 2 ATOMS",3,"ATOMS 2 :GRAMS",4,"MOLS 2 ATOMS",5,"ATOMS 2 MOLS",6)
:Input "CONVERT:",X
:Lbl 1
:Input "MOLS: ",K
:Input "MASS: ",M
:MKA
:Disp A
:"MOL2G"
:Goto 99
:Lbl 2
:Input "GRAMS: ",G
:Input "MASS: ",M
:G(1/M)A
:Disp A
:"G2MOLS"
:Goto 99
:Lbl 3
:Input "GRAMS: ",G
:Input "MASS: ",M
:(G(1/M)*(6.022*1023))A
:Disp A
:"G2ATOM"
:Goto 99
:Lbl 4
:Input "ATOMS: ",N
:Input "MASS: ",M
:M(1/(6.022*1023))NA
:Disp A
:"ATOM2G"
:Goto 99
:Lbl 5
:Input "MOLS: ",M
:M(6.022*1023)A
:Disp A
:"MOL2ATOM"
:Goto 99
:Lbl 6
:Input "ATOMS: ",B
:B(1/(6.022*1023))A
:Disp A
:"ATOM2MOL"
:Goto 99
:Lbl 99

Pre-Calc: Vector Angle

You have two 2D vectors and you want the angle on the plane between them.

-- Vector Angle --
:Input "X1: ",A
:Input "Y1: ",B
:Input "X2: ",C
:Input "Y2: ",D
:Degree
:cos-1(((AC)+(BD))/((A2+B2)(C2+D2)))M
:Disp M

Chemistry: Ideal Gas Law

Boyle's, Gay-Lussac's Law, and Charle's Law were all combined for everyone's convenience. It's a good thing too, or else this would've been bigger.
The good ol' PV = nRT. Pick the unknown variable in the menu. Insert the other data.

P: Pressure       >(atm)
V: Volume         >(Liters)
G: Grams          >(grams)
M: Molar Mass     >(g/mol)
T: Temperature    >(Kelvins)
N: Number of Mols >(mols)

-- Ideal Gas Law --
:Disp "IDEAL GAS LAW","P, V, M, G, T"
:(0.082)R
:Input "UNKNOWN: ",Str1
:If Str1="P"
:Then
:Prompt N,T,V
:((NRT)/V)P
:Disp "PRESSURE:",P
:End
:If Str1="V"
:Then
:Prompt N,T,P
:((NRT)/P)V
:Disp "VOLUME:",V
:End
:If Str1="G"
:Then
:Prompt P,V,T
:Input "MOLAR MASS: ",M
:((MPV)/(RT))G
:Disp "GRAMS:",G
:End
:If Str1="M"
:Then
:Prompt G,T,P,V
:((GRT)/(PV))M
:Disp "MOLAR MASS:",M
:End
:If Str1="T"
:Then
:Prompt P,V,N
:((PV)/(NR))T
:Disp "KELVINS:",T
:End

Chemistry: Graham's Law of Effusion

This is straightforward. Finds the mass of a gas during effusion.
e.g. Helium gas effuses 9 times faster than gas X. Find X's molar mass.
: >M = 4; >R = 9;      Unknown mass = 144

-- Graham's Law --
:Input "MOLAR MASS: ",M
:Input "RATE (Porportion): ",R
:(R2(M))A
:Disp "MOLAR MASS:",A

Geometry: Trigonomic Law

Law of Sines, Law of Cosines, who cares. You're too lazy to type the whole equation in.
Use this program. Pick the kind of triangle information you have.


-- Trig Law --
:Menu("Trigonomic Law","SAS",1,"SSS",2,"SAA",3,"SSA",4,"ASA",5
:Input "TYPE:  ",Str1
:Lbl 1
:Disp "USED WITH ANGLE"
:Disp "SAS"
:Prompt B,C,θ
:(B2+C2-((2(B)(C)(cos(θ))))D
:√(D)üA
:Disp "SIDE LENGTH",A
:"prgmCOSINE1"
:Goto 99
:Lbl 2
:Disp "USED WITH SIDES"
:Disp "SSS"
:Prompt A,B,C
:(A2-B2-C2)/(-2(BC))G
:cos-1(G)üX
:Disp "ANGLE OP A",X
:(B2-A2-C2)/(-2(AC))G
:cos-1(G)X
:Disp "ANGLE OP B",X
:(C2-A2-B2)/(-2(AB))G
:cos-1(G)X
:Disp "ANGLE OP C",X
:"prgmCOSINE"
:Goto 99
:Lbl 3
:Disp "S IS THE SIDE","OPPOSITE OF <A"
:Prompt A,S,B
:((S*sin(B))/(sin(A)))C
:Disp "SIDE OP B",C
:"prgmSINEANGL"
:Goto 99
:Lbl 4
:Disp "θ IS THE ANGLE","OPPOSITE OF A"
:Prompt A,θ,B
:((B*sin(θ))/A)M
:Disp M
:sin-1(M)N
:Disp "ANGLE OP B",N
:"prgmSINESIDE"
:Goto 99
:Lbl 5
:Disp "S IS THE SIDE","OPPOSITE OF <A"
:Prompt A,S,B
:((S*sin(B))/(sin(A)))C
:Disp "SIDE OP B",C
:"prgmSINEANGL"
:Lbl 99

Math: Quadratic Formula

It's a necessity.
e.g. x2-2x+1
: >A=1; >B=-2; >C=1
: x = -1

-- Quad.From --
:Prompt A,B,C
:B2-4ACD
:If D<0
:Then
:a+bi
:Else
:End
:(-B+(D))/(2A)Q
:(-B-(D))/(2A)R
:Disp Q,R

Geometry: Geometric Mean

Finds the geometric mean. Input the numerator of the first fraction and the denominator of the second.
e.g. 1/x = x/4 :x = 2

-- Geometric Mean --
:Disp "NUMBERS"
:Prompt A,B
:(A)(B)C
:(C)X
:Disp X

Geometry: Pythagorean Theorem

Shows C squared and C just in case you want to leave it in a radical. We all get too lazy to key in everything.
e.g. you have a 1, 1, and X triangle.
: We all know it is the square root of two, but the program shows 2 and the sqrt of 2 just in case.

-- Pythagorean Theorem --
:Prompt A,B
:(A2+B2)→D
:(D)C
:Disp D,C

Physics: Pressure

It's finding the stress you put on your feet when you stand.
e.g. 50 force units (usually Newtons) on a surface area of 20 distance units (centimeters, for example)
: You exert 2.5 force units per distance unit squared.
:With this knowledge, you can learn something useless, like the fact that its safer to crawl on ice than walk because you are putting less stress on a certain spot at the same time. 

-- Pressure --
:Input "FORCE: ",F
:Input "SURFACE AREA: ",B
:(F/B)A
:Disp A

Tuesday, April 19, 2011

Geometry: Distance and Midpoint

 This basically finds the midpoint and distance on a number line, a plane, and 3D space.
e.g. (0,0,0) and (1,0,0) :They are exactly one distance unit and have a midpoint of (0.5,0,0)

-- Distance and Midpoint --
:Disp "Dist, MidPoint","(1-3)"
:Input "Num Dimensions: ",X
:If X=1
:Then
:Prompt A,B
:abs(A-B)C
:If A<B
:(C/2)+AD
:If B<A
:(C/2)+BD
:Disp "MP:",D,"DIST:",C
:Else
:If X=2
:Then
:Prompt X,Y
:Input "X2:",A
:Input "Y2:",B
:((X-A)2+(Y-B)2)D
:((A+X)/2)Q
:((B+Y)/2)R
:Xdim(L1)
:QL1(1)
:RL1(2)
:Disp "MIDPOINT: XY",L1,"DIST:",D
:Else
:If X=3
:Then
:Prompt X,Y,Z
:Input "X2=?",A
:Input "Y2=?",B
:Input "Z2=?",C
:((A-X)2+(B-Y)2+(C-Z)2)D
:((A+X)/2)Q
:((B+Y)/2)R
:((C+Z)/2)S
:Xdim(L1)
:QL1(1)
:RL1(2)
:SL1(3)
:Disp "MIDPOINT: XYZ",L1,"Dist:",D
:End

Chemistry: Compositional Percentage

Percentage of an element in a compund. Input total molar mass of each element.
e.g. O2 Has a mass of 32 g/mol.

-- CompNum --
:Input "NUMBER 2-5:",N
:Disp "ELEMENT"
:If N=5
:Then
:Prompt A,B,C,D,E
:A+B+C+D+EX
:Disp 100(A/X),100(B/X),100(C/X),100(D/X),100(E/X)
:End
:If N=4
:Then
:Prompt A,B,C,D
:A+B+C+DX
:Disp 100(A/X),100(B/X),100(C/X),100(D/X)
:End
:If N=3
:Then
:Prompt A,B,C
:A+B+CX
:Disp 100(A/X),100(B/X),100(C/X)
:End
:If N=2
:Then
:Prompt A,B
:A+BX
:Disp 100(A/X),100(B/X)
:End

Chemistry: Percent Error

We are all lazy, so this pretty much proves that.

-- %Error --
:Input "OBSERVED:",O
:Input "ACCEPTED:",A
:(((O-A)/A)*100)Q
:Fix 2
:Disp Q,"PERCENT"
:Float

Started today.

No point in posting this. I'm basically talking to myself. I'll try to put up as many Chemistry and Math programs I can. I decided to do this because I was very, very bored.