Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: Adriweb on October 31, 2011, 08:37:52 am
-
(By the way, don't think that I'm talking about me at the third-person : this is a translation I've done of the original TI-Planet article ;-) )
Another exclusive TI-Planet program today!
Our dear member Adriweb, after releasing the Chemical Reaction analysis program for TI-83 + / 84 + ( http://tiplanet.org/forum/archives_voir.php?id=1308 (http://tiplanet.org/forum/archives_voir.php?id=1308) ) , has now programmed its Nspire version ! This is a first on this calculator, especially as it profits from the main new feature offered by the OS 3 : Lua Scripting, like the program TabVar 3 (http://tiplanet.org/forum/viewtopic.php?t=8380), presented yesterday.
This .tns document actually consists of two parts:
-> You run the program (TI-Basic) avancement() and follow the steps to provide information on the chemical reaction to be studied.
-> Go to the next tab and watch the table drawn in detail and in color (Nspire CX only) !
A screenshot?
(http://tiplanet.org/modules/archives/captures/1320062663avancementnspire.jpg)
This program is open source and licensed under the Creative Commons BY-SA 2.0.
Source code : https://github.com/adriweb/Tableau-d-Avancement-LUA/blob/master/TableauAvancement.lua (https://github.com/adriweb/Tableau-d-Avancement-LUA/blob/master/TableauAvancement.lua)
Link the topic of TIPlanet (more info + download ....): http://tiplanet.org/forum/viewtopic.php?f=43&t=8385 (http://tiplanet.org/forum/viewtopic.php?f=43&t=8385)
Download link directly : http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754 (http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754)
(Click on the "Telecharger" button)
TI-Planet.org : the website that creates smart programs !
By the way, Happy Halloween;-)
-
Nice work !
It is really useful...
-
Thanks !
I still have to improve the zoom (that works) and pan (that doesn't :P)
-
nice, you should translate it to english.
-
Sure :-)
Thanks
-
/me wants
It looks great!
-
Good work!
All the recent Lua programs that come out show that (Nspire) Lua is pretty good, and with some programming skills you can make wonderful stuff :)
-
All right, I finished the translation and updated the graphical and rounding routines at the same time.
The updated version has been posted, and it's at the same place on TI-Planet :
http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754 (http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754)
-
This is awesome. If that wasn't for the fact Omni news are exclusively for calc gaming and calc games development related stuff, that would easily go there.
I'll probably check this out when I have a chance.
-
All right, I finished the translation and updated the graphical and rounding routines at the same time.
The updated version has been posted, and it's at the same place on TI-Planet :
http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754 (http://tiplanet.org/index.php?mod=archives&ac=voir&id=3754)
It's it for cas version only?
-
Updated the archive and everything again.
It now comes with a real chemical equation for the demo >.> (sorry, lol)
It should work for non-CAS.
Here's the TI-Basic part source code :
Define LibPub avancement_en()=
Prgm
:Local i,tmp1
:DelVar lnoms
:DelVar lmoles
:DelVar lcoeff
:DelVar lreste
:DelVar reactlim
:luasignal:=−1337
:nbrreact:=0: nbrprod:=0
:While nbrreact=0
: Request "How many reagants ? ",nbrreact
:EndWhile
:For i,1,nbrreact
: RequestStr "Symbol of reagent n°"&string(i)&" ? ",lnoms[i]
: Request "Coefficient of reagent n°"&string(i)&" ? ",lcoeff[i]
: Request "How many moles of reagant n°"&string(i)&" ? ",lmoles[i]
:EndFor
:Disp "---------"
:While nbrprod=0
: Request "How many product(s) ? ",nbrprod
:EndWhile
:For i,nbrreact+1,nbrreact+nbrprod
: RequestStr "Symbol of product n°"&string(i-nbrreact)&" ? ",lnoms[i]
: Request "Coefficient of product n°"&string(i-nbrreact)&" ? ",lcoeff[i]
: Request "How many moles of product n°"&string(i-nbrreact)&" ? ",lmoles[i]
:EndFor
:Disp "---------"
:reactlim:=0
:xmax:=9000
:For i,1,nbrreact
: tmp1:=((lmoles[i])/(lcoeff[i]))
: If tmp1<xmax Then
: reactlim:=reactlim+1
: xmax:=tmp1
: Else
: If tmp1=xmax Then
: xmax:=−1
: EndIf
: EndIf
:EndFor
:If xmax>0 Then
: Disp "Limitant reagent : n°",reactlim
: Disp "Xmax = ",approx(xmax)," mol."
:Else
: xmax:=((lmoles[1])/(lcoeff[1]))
: Disp "Stoechiometrical proportions."
: Disp "Xmax = ",approx(xmax)," mol."
:EndIf
:For i,1,nbrreact
: lreste[i]:=approx(lmoles[i]-xmax)
: If i≠reactlim Then
: Disp "There is/are ",approx(lmoles[i]-xmax)," moles of ",lnoms[i]," left."
: Else
: lreste[i]:=0
: Disp "There is no more ",lnoms[i]
: EndIf
:EndFor
:For i,nbrreact+1,nbrreact+nbrprod
: lreste[i]:=approx(lmoles[i]+lcoeff[i]*xmax)
: Disp lreste[i]," moles of ",lnoms[i]," has/have been made."
:EndFor
:xmax:=string(approx(xmax))
:luasignal:=42+rand()
:Disp "---------"
:Disp "The summary table is in the following tab."
:EndPrgm
Screenshot of version 1.25 :
(http://i.imgur.com/HBhlr.jpg)
-
Yay, good work!