Author Topic: Formulum: Texas Instruments Version  (Read 27277 times)

0 Members and 2 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Formulum: Texas Instruments Version
« on: October 19, 2010, 06:01:49 pm »
Hey, I'm a Python programmer, and I've made quite a good program in Python:

http://code.google.com/p/formulum/

It's really hard to do something like this in Python :S:

Code: [Select]
import wx
import math

class MainFrame(wx.Frame):
   
    def __init__(self, parent,id):
        wx.Frame.__init__(self, parent,id, 'Formulum', size=(415,135))
        panel=wx.Panel(self)
     
       
        ChooseFormulaButtonImage=wx.Image("chooseformulabutton.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        self.ChooseFormulaButton=wx.BitmapButton(panel, -1, ChooseFormulaButtonImage, pos=(10,10))
        self.Bind(wx.EVT_BUTTON, self.ChooseFormula, self.ChooseFormulaButton)
       
        AboutButtonImage=wx.Image("aboutbutton.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        self.AboutButton=wx.BitmapButton(panel, -1, AboutButtonImage, pos=(200,10))
        self.Bind(wx.EVT_BUTTON, self.About, self.AboutButton)
       
        ExitButtonImage=wx.Image("exitbutton.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        self.ExitButton=wx.BitmapButton(panel, -1, ExitButtonImage, pos=(200,50))
        self.Bind(wx.EVT_BUTTON, self.Close, self.ExitButton)
       
        HelpButtonImage=wx.Image("helpbutton.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
        self.HelpButton=wx.BitmapButton(panel, -1, HelpButtonImage, pos=(10,50))
        self.Bind(wx.EVT_BUTTON, self.Help, self.HelpButton)
   
    def ChooseFormula(self, event):
        ChoiceBox=wx.SingleChoiceDialog(None, "Which formula do you want to use?", "Formulum", ['Circle Area', 'Square Area', 'Rectangle Area', 'Parallelogram Area', 'Trapezium Area', 'Cube Surface Area', 'Spherical Surface Area', 'Sphere Volume', 'Cylinder Volume', 'Quadrangular Prism Volume','Cone Volume', 'Cube Surface Area', 'Parallelepiped Volume', 'Parallelepiped Surface Area','Quadrangular Pyramid Volume', 'Quadrangular Pyramid Surface Area'])
        if ChoiceBox.ShowModal()==wx.ID_OK:
            Answer=ChoiceBox.GetStringSelection()
        if Answer == "Circle Area":
            RadiumInput=wx.TextEntryDialog(None, "Enter the radium:", 'Circle Area', 'Enter radium...')
            if RadiumInput.ShowModal()==wx.ID_OK:
                Radium=float(RadiumInput.GetValue())
                circlearea=(Radium**2)*math.pi
                box = wx.MessageDialog(None, "The area of the circle which radium is " + str(Radium)+ " is:\n\n " + str(circlearea), 'Circle Area', wx.OK)
                varanswer1 = box.ShowModal()
                box.Destroy()
        if Answer == "Square Area":
            SideInput=wx.TextEntryDialog(None, "Enter the side:", 'Square Area', 'Enter side...')
            if SideInput.ShowModal()==wx.ID_OK:
                Side=float(SideInput.GetValue())
                squarearea=Side*Side
                box = wx.MessageDialog(None, "The area of the square which side is " + str(Side)+ " is:\n\n " + str(squarearea), 'Square Area', wx.OK)
                varanswer2 = box.ShowModal()
                box.Destroy()
        if Answer == "Rectangle Area":
            LengthInput=wx.TextEntryDialog(None, "Enter the length: ", 'Rectangle Area', 'Enter lenth...')
            WidthInput=wx.TextEntryDialog(None, "Enter the width: ", 'Rectangle Area', 'Enter width...')
            if LengthInput.ShowModal()==wx.ID_OK and WidthInput.ShowModal()==wx.ID_OK:
                Length=float(LengthInput.GetValue())
                Width=float(WidthInput.GetValue())
                rectanglearea= Length * Width
                box = wx.MessageDialog(None, "The area of the rectangle is:\n\n " + str(rectanglearea), 'Rectangle Area', wx.OK)
                varanswer3 = box.ShowModal()
                box.Destroy()
        if Answer == "Parallelogram Area":
            BaseInput=wx.TextEntryDialog(None, "Enter the length of the base: ", 'Parallelogram Area', 'Enter base lenght...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height: ", 'Parallelogram Area', 'Enter height...')
            if BaseInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                Base = float(BaseInput.GetValue())
                Height=float(HeightInput.GetValue())
                parallelogramarea = Base * Height
                box = wx.MessageDialog(None, "The area of the parallelogram is:\n\n " + str(parallelogramarea), 'Parallelogram Area', wx.OK)
                varanswer4 = box.ShowModal()
                box.Destroy()
        if Answer=="Trapezium Area":
            LargerBaseInput=wx.TextEntryDialog(None, "Enter the length of the larger base:", 'Trapezium Area', 'Enter length...')
            SmallerBaseInput=wx.TextEntryDialog(None, "Enter the length of the smaller base:", 'Trapezium Area', 'Enter length...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Trapezium Area', 'Enter heigth...')
            if LargerBaseInput.ShowModal()==wx.ID_OK and SmallerBaseInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                LargerBase=float(LargerBaseInput.GetValue())
                SmallerBase=float(SmallerBaseInput.GetValue())
                Height=float(HeightInput.GetValue())
                trapeziumarea = ((LargerBase + SmallerBase) / 2) * Height
                box = wx.MessageDialog(None, "The area of the trapezium is:\n\n " + str(trapeziumarea), 'Trapezium Area', wx.OK)
                varanswer5 = box.ShowModal()
                box.Destroy()
        if Answer == "Spherical Surface Area":
            RadiumInput=wx.TextEntryDialog(None, "Enter the radium:", 'Spherical Surface Area', 'Enter radium...')
            if RadiumInput.ShowModal()==wx.ID_OK:
                Radium=float(RadiumInput.GetValue())
                sphericalsurfacearea = (4 * math.pi * (Radium ** 2))
                box = wx.MessageDialog(None, "The spherical surface area is:\n\n " + str(sphericalsurfacearea), 'Spherical Surface Area', wx.OK)
                varanswer6 = box.ShowModal()
                box.Destroy()
        if Answer == "Sphere Volume":
            RadiumInput=wx.TextEntryDialog(None, "Enter the radium:", 'Sphere Volume', 'Enter radium...')
            if RadiumInput.ShowModal()==wx.ID_OK:
                Radium=float(RadiumInput.GetValue()) 
                spherevolume= 4 * math.pi * (Radium) ** 3/3
                box = wx.MessageDialog(None, "The volume of the sphere is:\n\n " + str(spherevolume), 'Sphere Volume', wx.OK)
                varanswer7 = box.ShowModal()
                box.Destroy() 
        if Answer=="Cylinder Volume":
            RadiumInput=wx.TextEntryDialog(None, "Enter the radium:", 'Cylinder Volume', 'Enter radium...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Cylinder Volume', 'Enter height...')
            if RadiumInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                Radium=float(RadiumInput.GetValue())
                Height=float(HeightInput.GetValue())
                cylindervolume = ((math.pi * (Radium ** 2)) * Height)
                box = wx.MessageDialog(None, "The cylinder volume is:\n\n " + str(cylindervolume), 'Cylinder Volume', wx.OK)
                varanswer7 = box.ShowModal()
                box.Destroy()
        if Answer=="Quadrangular Prism Volume":
            SideOfBaseInput=wx.TextEntryDialog(None, "Enter the side of base: ", 'Quadrangular Prism Volume', 'Enter side of base...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height: ", 'Quandrangular Prism Volume', 'Enter height...')
            if HeightInput.ShowModal()==wx.ID_OK and SideOfBaseInput.ShowModal()==wx.ID_OK:
                SideOfBase=float(SideOfBaseInput.GetValue())
                Height=float(HeightInput.GetValue())
                quadrangularprismvolume = (SideOfBase**2)*Height
                box = wx.MessageDialog(None, "The quadrangular prism volume is:\n\n " + str(quadrangularprismvolume), 'Quadrangular Prism Volume', wx.OK)
                varanswer8 = box.ShowModal()
                box.Destroy()
        if Answer=="Cone Volume":
            RadiumInput=wx.TextEntryDialog(None, "Enter the radium:", 'Cylinder Volume', 'Enter radium...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Cylinder Volume', 'Enter height...')
            if RadiumInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                Radium=float(RadiumInput.GetValue())
                Height=float(HeightInput.GetValue())
                conevolume = (((math.pi * (Radium ** 2)) * Height) / 3) 
                box = wx.MessageDialog(None, "The cone volume is:\n\n " + str(conevolume), 'Cone Volume', wx.OK)
                varanswer9 = box.ShowModal()
                box.Destroy()
        if Answer=="Cube Volume":
            EdgeInput=wx.TextEntryDialog(None, "Enter the edge:", 'Cube Volume', 'Enter edge...')
            if EdgeInput.ShowModal()==wx.ID_OK:
                Edge=float(EdgeInput.GetValue())
                cubevolume = Edge**3
                box = wx.MessageDialog(None, "The cube volume is:\n\n " + str(cubevolume), 'Cube Volume', wx.OK)
                varanswer10 = box.ShowModal()
                box.Destroy()
        if Answer=="Cube Surface Area":
            EdgeInput=wx.TextEntryDialog(None, "Enter the edge:", 'Cube Surface Area', 'Enter edge...')
            if EdgeInput.ShowModal()==wx.ID_OK:
                Edge=float(EdgeInput.GetValue())
                cubesurfacearea = 6 * (Edge**2)
                box = wx.MessageDialog(None, "The cube surface area is:\n\n " + str(cubesurfacearea), 'Cube Surface Area', wx.OK)
                varanswer11 = box.ShowModal()
                box.Destroy()
        if Answer=="Parallelepiped Volume":
            LengthInput=wx.TextEntryDialog(None, "Enter the length:", 'Cube Volume', 'Enter length...')
            WidthInput=wx.TextEntryDialog(None, "Enter the width:", 'Cube Volume', 'Enter width...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Cube Volume', 'Enter heigth...')
            if LengthInput.ShowModal()==wx.ID_OK and WidthInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                Length=float(LengthInput.GetValue())
                Width=float(WidthInput.GetValue())
                Height=float(HeightInput.GetValue())
                parallelepipedvolume = Length*Width*Height
                box = wx.MessageDialog(None, "The Parallelepiped Volume is:\n\n " + str(parallelepipedvolume), 'Parallelepiped Volume', wx.OK)
                varanswer12 = box.ShowModal()
                box.Destroy()
        if Answer=="Parallelepiped Surface Area":
            LengthInput=wx.TextEntryDialog(None, "Enter the length:", 'Parallelepiped Surface Area', 'Enter length...')
            WidthInput=wx.TextEntryDialog(None, "Enter the width:", 'Parallelepiped Surface Area', 'Enter width...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Parallelepiped Surface Area', 'Enter heigth...')
            if LengthInput.ShowModal()==wx.ID_OK and WidthInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                Length=float(LengthInput.GetValue())
                Width=float(WidthInput.GetValue())
                Height=float(HeightInput.GetValue())
                parallelepipedsurfacearea = ((Length + Width + Length + Width)*Height) + ((Length*Width)*2)
                box = wx.MessageDialog(None, "The parallelepiped surface area is:\n\n " + str(parallelepipedsurfacearea), 'Parallelepiped Surface Area', wx.OK)
                varanswer13 = box.ShowModal()
                box.Destroy()
        if Answer=="Quadrangular Pyramid Volume":
            SideOfBaseInput=wx.TextEntryDialog(None, "Enter the side of base:", 'Quadrangular Pyramid Volume', 'Enter side of base...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Quadrangular Pyramid Volume', 'Enter height...')
            if SideOfBaseInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                SideOfBase=float(SideOfBaseInput.GetValue())
                Height=float(HeightInput.GetValue())
                quadrangularpyramidvolume = ((SideOfBase ** 2) * Height) / 3
                box = wx.MessageDialog(None, "The Quadrangular Pyramid Volume is:\n\n " + str(quadrangularpyramidvolume), 'Quadrangular Pyramid Volume', wx.OK)
                varanswer14 = box.ShowModal()
                box.Destroy()   
        if Answer=="Quadrangular Pyramid Surface Area":
            SideOfBaseInput=wx.TextEntryDialog(None, "Enter the side of base:", 'Quadrangular Pyramid Surface Area', 'Enter side of base...')
            HeightInput=wx.TextEntryDialog(None, "Enter the height:", 'Quadrangular Pyramid Surface Area', 'Enter height...')
            if SideOfBaseInput.ShowModal()==wx.ID_OK and HeightInput.ShowModal()==wx.ID_OK:
                SideOfBase=float(SideOfBaseInput.GetValue())
                Height=float(HeightInput.GetValue())
                quadrangularpyramidsurfacearea = (SideOfBase*4*Height) * (2 *(SideOfBase**2))
                box = wx.MessageDialog(None, "The Quadrangular Pyramid Surface Area is:\n\n " + str(quadrangularpyramidvolume), 'Quadrangular Pyramid Surface Area', wx.OK)
                varanswer15 = box.ShowModal()
                box.Destroy()
    def About(self, event):
        aboutbox = wx.MessageDialog(None, 'Formulum v2.0 - by David Gomes', 'About Formulum', wx.OK)
        aboutanswer = aboutbox.ShowModal()
        aboutbox.Destroy()
       
    def Close(self, event):
        exitbox = wx.MessageDialog(None, 'Do you really want to leave?', 'Exit', wx.YES_NO)
        if exitbox.ShowModal()==wx.ID_YES:
            exitbox.Destroy()
            self.Destroy();
        else:
            exitbox.Destroy()
       
    def Help(self, event):
        helpbox = wx.MessageDialog(None, 'Press Choose Formula to calculate areas and volumes\n\nPress About to see Info\n\nScoutDavid', 'Help', wx.OK)
        helpanswer = helpbox.ShowModal()
        helpbox.Destroy()   
       
if __name__=='__main__':
    app=wx.PySimpleApp()
    frame=MainFrame(parent=None, id= -1)
    frame.Show()
    app.MainLoop()

So, check the program:

http://code.google.com/p/formulum/downloads/detail?name=Formulum2.1.zip&can=2&q=#makechanges

I'll make something that looks alike it to TI Nspire.

I'll be posting some progresses here tomorrow if I can:)

For now, just try Formulum


David

Offline TC01

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 344
  • Rating: +9/-0
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #1 on: October 19, 2010, 07:32:31 pm »
Python!

Um, I mean, so... you trying to make a Python program with an Nspire-style interface for formula solving?



The userbars in my sig are links embedded links.

And in addition to calculator (and Python!) stuff, I mod Civilization 4 (frequently with Python).

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #2 on: October 19, 2010, 07:39:58 pm »
Python!

Um, I mean, so... you trying to make a Python program with an Nspire-style interface for formula solving?

No, a NSpire Program for formula solving, similar to Formulum(the idea)
« Last Edit: October 19, 2010, 07:40:24 pm by ScoutDavid »

Offline kyllopardiun

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 178
  • Rating: +14/-4
  • Kyllopardiun over 2000 results in google.
    • View Profile
    • Kyllo's blog (a blog about poetry, videos and computing)
Re: Formulum: Texas Instruments Version
« Reply #3 on: October 19, 2010, 10:37:08 pm »
Well, good lucky, and I think in Nspire 2.x it won't be difficulty for you do ...
but you could just write a simpler thing in nspire [working on 1.4-2.x]
with many well documented functions...

EDIT:

if you want I can do it for you, and you will be able to look at, and see how simple it is,
and then do this program using the request, which is available just for 2.x OSes
« Last Edit: October 19, 2010, 10:40:29 pm by kyllopardiun »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Formulum: Texas Instruments Version
« Reply #4 on: October 19, 2010, 11:07:52 pm »
Nice, hopefully this can be greatly useful for students.  I personally wouldn't use it as I am out of school since 2004 and had my last math classes in 2003, but other people might find it useful.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #5 on: October 20, 2010, 09:41:56 am »
Nice, hopefully this can be greatly useful for students.  I personally wouldn't use it as I am out of school since 2004 and had my last math classes in 2003, but other people might find it useful.

That's just the goal.
Well, good lucky, and I think in Nspire 2.x it won't be difficulty for you do ...
but you could just write a simpler thing in nspire [working on 1.4-2.x]
with many well documented functions...

EDIT:

if you want I can do it for you, and you will be able to look at, and see how simple it is,
and then do this program using the request, which is available just for 2.x OSes

I'm using request yeah but I will do it, I need to practise TI Basic

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #6 on: October 21, 2010, 09:57:54 am »
Here is some progress, a few formulas working fine already.

Sorry for double post, but it makes sense :S


Save it, try it and comment please. I will be adding more formulas, something like more 12 formulas, but for now only these. Later today...

Thx for help :) (even though I've had no problem until now)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #7 on: October 21, 2010, 11:41:34 am »
There's not much to practice in the way of Nspire BASIC. Input, disp, text, and a few math functions are all that are really useful, IMO. :P
« Last Edit: October 21, 2010, 11:41:48 am by willrandship »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #8 on: October 21, 2010, 12:36:39 pm »
There's not much to practice in the way of Nspire BASIC. Input, disp, text, and a few math functions are all that are really useful, IMO. :P

Yeah, but as long as we keep making this kind of programs to keep Nspire alive :D

I'll be posting screenshots in a few minutes :D

Offline kyllopardiun

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 178
  • Rating: +14/-4
  • Kyllopardiun over 2000 results in google.
    • View Profile
    • Kyllo's blog (a blog about poetry, videos and computing)
Re: Formulum: Texas Instruments Version
« Reply #9 on: October 21, 2010, 01:05:10 pm »
There's not much to practice in the way of Nspire BASIC. Input, disp, text, and a few math functions are all that are really useful, IMO. :P

Yeah, but as long as we keep making this kind of programs to keep Nspire alive :D

I'll be posting screenshots in a few minutes :D

ndless 1.7 will keep nspire alive ... //it already does, but not officially

someday in the future the touchpad, will get it too,
but, don't expect much as 1.7 isn't released yet...

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #10 on: October 21, 2010, 01:30:35 pm »
Here are some screenshots, please comment with any tips please

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Formulum: Texas Instruments Version
« Reply #11 on: October 21, 2010, 07:58:07 pm »
Nice, but I wonder if it's possible to add titles in those black bars?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #12 on: October 22, 2010, 11:58:43 am »
Nice, but I wonder if it's possible to add titles in those black bars?

So do I, anyone knows if this is possible? I will update this thread soon with a new file and more GIFs :)

Offline kyllopardiun

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 178
  • Rating: +14/-4
  • Kyllopardiun over 2000 results in google.
    • View Profile
    • Kyllo's blog (a blog about poetry, videos and computing)
Re: Formulum: Texas Instruments Version
« Reply #13 on: October 22, 2010, 12:34:05 pm »
Good work,
but i think it would be more optimized without all that request thing...
Don't missunderstand me, I not saying your program isn't great,

But, in my opinion just all those functions, would be better also if you need to calculate something else ...
//I don't know if what you wrote is functions or prgrm

but my tip is:

if it isn't a function, then convert it into one:
Let me say you have a circle area, and need to find the radius

you could easily do nsolve(circlearea(x)=40,x);
and i don't know if you can use this, while using request...
« Last Edit: October 22, 2010, 12:34:39 pm by kyllopardiun »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Formulum: Texas Instruments Version
« Reply #14 on: October 22, 2010, 02:30:51 pm »
Good work,
but i think it would be more optimized without all that request thing...
Don't missunderstand me, I not saying your program isn't great,

But, in my opinion just all those functions, would be better also if you need to calculate something else ...
//I don't know if what you wrote is functions or prgrm

but my tip is:

if it isn't a function, then convert it into one:
Let me say you have a circle area, and need to find the radius

you could easily do nsolve(circlearea(x)=40,x);
and i don't know if you can use this, while using request...


It is several programs. When I did it as a function, I couldn't work with it :S