Skip to content

Commit

Permalink
user can set number of rectangles to improve approximation of integral
Browse files Browse the repository at this point in the history
  • Loading branch information
maettu committed Oct 23, 2011
1 parent c76402d commit 380bb1d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions integrale.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class MainWindow( QDialog ):

self.rectanglesFunction = []
self.rectanglesIntegral = []

self.numberRectanglesSpinBox = QDoubleSpinBox()
self.numberRectanglesSpinBox.setMinimum ( 1 )
self.numberRectanglesSpinBox.setValue( 10 )
self.numberRectanglesSpinBox.setSingleStep( 1 )


self.functionPlot = self.ccsFunction.addFunction( self.function )
Expand All @@ -106,7 +111,7 @@ class MainWindow( QDialog ):

self.integralPlot = self.ccsIntegral.addFunction( self.integral )

# TODO: check that on scale out ccs expand
# TODO: check that on scale out ccs expand.


self.scaleInButton = QPushButton( "scale in" )
Expand Down Expand Up @@ -137,8 +142,10 @@ class MainWindow( QDialog ):
layoutChangeFunction = QHBoxLayout ()
layout.addLayout ( layoutChangeFunction )
layoutChangeFunction.addWidget ( self.editFunction )

layoutChangeFunction.addWidget ( self.editFunctionMessage )

layoutChangeFunction.addWidget ( self.numberRectanglesSpinBox )

layout.addWidget ( viewIntegral )

layout.addWidget ( QLabel( "Funktion: " ) )
Expand Down Expand Up @@ -173,6 +180,9 @@ class MainWindow( QDialog ):
self.connect ( self.scaleOutButton, SIGNAL( "clicked()" ),
self.scaleOut )

self.connect (self.numberRectanglesSpinBox, SIGNAL( "valueChanged(double)" ),
self.changeFunction )


self.setWindowTitle ( "Integrale anzeigen und raten" )

Expand Down Expand Up @@ -202,6 +212,8 @@ class MainWindow( QDialog ):
# then the app is reset.
def changeFunction( self ):

self.numberRectangles = self.numberRectanglesSpinBox.value()

# erase bars & points
for i in self.rectanglesFunction:
self.sceneFunction.removeItem( i )
Expand Down

0 comments on commit 380bb1d

Please sign in to comment.