This is my second program I wrote for TI-89. Can someone who thinks that knows TI-BASIC well, takes a quick look.
Please make some comment. Tell me what is good and what should I change to make this faster, more efficient or simply not so complicated.
Thanks
Program takes input from user, and calculates some equations stored in global variables, that are dependent on x and y coordinates.
User can than choose to input some points (up to 6 for each equation) and get results in those points.
Code:
Please make some comment. Tell me what is good and what should I change to make this faster, more efficient or simply not so complicated.
Thanks
Program takes input from user, and calculates some equations stored in global variables, that are dependent on x and y coordinates.
User can than choose to input some points (up to 6 for each equation) and get results in those points.
Code:
()
Prgm
ClrIO
Local a,b,h,e,v,m,n,amn,dd2,dd3,dd4,dd5,dd6,dd7,dd8,z,x_1,x_2,x_3,x_4,x_5,x_6,y_1,y_2,y_3,y_4,y_5,y_6,st,i,old,j,q,key,txt
DelVar ch
// Home screen with custom menu
Lbl home
ClrIO
Output 20,22,"Program za izracun"
Output 28,20,"prostolezecih plosc"
Output 62,2,"v.1.3.1"
Toolbar
Title "Program"
Item "Pobrisi podatke",clr
Item "Izhod",end
Title "Plosca"
Item "Vnos podatkov",vnos
Item "Izracunaj",racun
Item "Tocke",koor
EndTbar
Goto home
// User input
Lbl vnos
ClrIO
Input "Stranica a=? [m]",a
Input "Stranica b=? [m]",b
Input "Debelina h=? [m]",h
Input "Elast. modul e=? [kN/m2]",e
Input "Poissonov kolicnik v=?",v
Prompt m,n,amn
1ch
Goto home
Lbl racun
ClrIO
// Chek if input was made, if not display warning and return to home
If isVar(ch)true Then
Output 33,0,"Pred racunom vnesi podatke."
Pause
Goto home
EndIf
// Calculations
setMode({"3","1","14","1"})old
DelVar x,y
e*h^3/(12*(1-v^2))k
Pause "k="&string(k)
amn/(k*Œ^4*(m/a^2+n/b^2)^2)wmn
Pause "w"&string(m)&string(n)&"="&string(wmn)
wmn*sin(Œ*x/a)*sin(Œ*y/b)w
Pause "w(x,y)="&string(w)
k*(¼(w,x,2)+v*¼(w,y,2))mxx
Pause "mxx(x,y)="&string(mxx)
k*(¼(w,y,2)+v*¼(w,x,2))myy
Pause "myy(x,y)="&string(myy)
k*(1-v)*¼(¼(w,x),y)mxy
Pause "mxy(x,y)="&string(mxy)
k*(¼(w,x,3)+¼(¼(w,x),y,2))qx
Pause "qx(x,y)="&string(qx)
k*(¼(w,y,3)+¼(¼(w,y),x,2))qy
Pause "qy(x,y)="&string(qy)
k*(¼(w,x,3)+(2-v)*¼(¼(w,x),y,2))qxp
Pause "qxp(x,y)="&string(qxp)
k*(¼(w,y,3)+(2-v)*¼(¼(w,y),x,2))qyp
Pause "qyp(x,y)="&string(qyp)
setMode(old)
Goto home
// Calculate values in points (x,y)
Lbl koor
ClrIO
setMode({"3","1","14","1"})old
// Choose number of points for each equation
Dialog
Text "Izberi zeljeno stevilo tock za:"
DropDown "w?",{"0","1","2","3","4","5","6"},dd1
DropDown "Mxx?",{"0","1","2","3","4","5","6"},dd2
DropDown "Myy?",{"0","1","2","3","4","5","6"},dd3
DropDown "Mxy?",{"0","1","2","3","4","5","6"},dd4
DropDown "qx?",{"0","1","2","3","4","5","6"},dd5
DropDown "qy?",{"0","1","2","3","4","5","6"},dd6
DropDown "qxp?",{"0","1","2","3","4","5","6"},dd7
DropDown "qyp?",{"0","1","2","3","4","5","6"},dd8
EndDlog
{"w","Mxx","Myy","Mxy","qx","qy","qxp","qyp"}txt
For i,1,8 //For loop from 1 to 8, one for each equation. Input all coordinates for one equation.
#("dd"&string(i))z
If z1 Then // If user chooses 0 points, skip to the next equation
For p,1,z-1 // For loop, for number of points (1-6), displays that many dialogs for coordinate input (x1,y1) (x2,y2)...
Dialog
Title "Vnesi koordinate tock"
Text string(txt[i])&" Tocka "&string(p)&"/"&string(z-1)
Request "x"&string(p),#("x_"&string(p))
Request "y"&string(p),#("y_"&string(p))
EndDlog
EndFor
ClrIO
For j,1,z-1 // Another For loop, for number of points (1-6). Display all resualts for one equation.
expr("x_"&string(j))x // Converts x coordinates from previous for loop to expression
expr(x)x
expr("y_"&string(j))y // Converts y coordinates from previous for loop to expression
expr(y)y
If i=1 and j<z Then // Put coordinates in equations stored in w,mxx,myy...and display values in points
Output 2+(j-1)*11,2,"w("&string(x)&","&string(y)&")="&string(w)
ElseIf i=2 and j<z Then
Output 2+(j-1)*11,2,"Mxx("&string(x)&","&string(y)&")="&string(mxx)
ElseIf i=3 and j<z Then
Output 2+(j-1)*11,2,"Myy("&string(x)&","&string(y)&")="&string(myy)
ElseIf i=4 and j<z Then
Output 2+(j-1)*11,2,"Mxy("&string(x)&","&string(y)&")="&string(mxy)
ElseIf i=5 and j<z Then
Output 2+(j-1)*11,2,"qx("&string(x)&","&string(y)&")="&string(qx)
ElseIf i=6 and j<z Then
Output 2+(j-1)*11,2,"qy("&string(x)&","&string(y)&")="&string(qy)
ElseIf i=7 and j<z Then
Output 2+(j-1)*11,2,"qxp("&string(x)&","&string(y)&")="&string(qxp)
ElseIf i=8 and j<z Then
Output 2+(j-1)*11,2,"qyp("&string(x)&","&string(y)&")="&string(qyp)
EndIf
EndFor
Pause
EndIf
EndFor
setMode(old)
Goto home
// Clear all results
Lbl clr
DelVar a,b,h,e,v,m,n,amn,dd2,dd3,dd4,dd5,dd6,dd7,dd8,z,x_1,x_2,x_3,x_4,x_5,x_6,y_1,y_2,y_3,y_4,y_5,y_6,st,i,old,j,mxx,myy,mxy,qx,qy,qxp,qyp,k,wmn,w,ch,txt
Goto home
Lbl end
ClrIO
DelVar x,y,ch
Pause
DispHome
EndPrgm