Posts

Showing posts from January, 2021

PyQT5 Exit Confirmation

Image
This is a small post explaining how you can add an exit confirmation to your PyQT5 code. Simply add this code to your MainWindow class: Remember to: [PyQT5] from PyQt5.QtWidgets import QMessageBox [PySide2] from PySide2.QtWidgets import QMessageBox def closeEvent(self, event):       quit_msg = "Are you sure you want to exit the program?"       reply = QMessageBox.question(self, 'Message',                      quit_msg, QMessageBox.Yes, QMessageBox.No)       if reply == QMessageBox.Yes:          event.accept()       else:          event.ignore()   Ubuntu Message Box:  

Calculus: Proving the Power Rule

Image
You've probably started to study derivatives and you've come across this rule which you were wondering how to proof.   So, how do we go about this? If you remember the definition of what a derivative is (the rate at which y changes with respect to x), we may get to what we want to proof by using the binomial theorem [1][2] and differentiating .   1º Step:   2º Step (using the binomial theorem [1] we expand the power): Exercise: Using pascal's triangle and the binomial theorem try to complete the missing part for n=4 3º Step (factor out the , remove the and let approach 0): I hope you have understood the proof and that you enjoyed the links below. If you have any doubts, don't hesitate to contact me. [1] Khan Academy Binomial Theorem  [2] Binomial Coefficients (may help you with [1])   . .   x n