Monday, September 12, 2016

Simple Python Calculators

Simple Derivative Calculator

def derivative_calculator_simple():
print ("Derivative: Ax^B = BAx^B-1")
constant = int(input("Type in the Constant: "))
exponent = int(input("Type in the Exponent: "))
new_base = (constant*exponent)
new_base = str(new_base)
new_exponent = (exponent-1)
new_exponent = str(new_exponent)
print ( "Derivative = "+ (new_base) + "x^" +  (new_exponent))
derivative_calculator_simple()

Simple Addition Derivative Calculator

def addition_derivative_calculator_simple():
print ("Normal Derivative: Ax^B = BAx^B-1")
print ("Addition Derivative: (Ax^B)+(Cx^D) = (BAx^B-1)+(DCx^D-1")
constanta = int(input("Type in the Constant of the First Derivative: "))
exponenta = int(input("Type in the Exponent of the First Derivative: "))
constantb = int(input("Type in the Constant of the Second Derivative: "))
exponentb = int(input("Type in the Exponent of the Second Derivative: "))
new_basea = (constanta*exponenta)
new_basea = str(new_basea)
new_exponenta = (exponenta-1)
new_exponenta = str(new_exponenta)
new_baseb = (constantb*exponentb)
new_baseb = str(new_baseb)
new_exponentb = (exponentb-1)
new_exponentb = str(new_exponentb)
print ( "Derivative = "+ (new_basea) + "x^" +  (new_exponenta)+" + "+(new_baseb) + "x^" +  (new_exponentb))
addition_derivative_calculator_simple() 

Point Slope Calculator

def point_slope_calculator():
print ("Point Slope Formula: y-y1=m(x-x1)")
x1 = int(input("Type in the Value of x1: "))
y1 = int(input("Type in the Value of y1: "))
m = int(input("Type in the Slope of The Tangent Line (Must Be A Whole Number): "))
a = (m*x1)
b = (a+y1)
m = str(m)
a = str(a)
b = str(b)
print ( "y = "+ (m) + "x" +" +"+(b))
point_slope_calculator()

Average Rate of Change Calculator

def average_rate_of_change_calculator():
print ("Average Rate of Change: fa-fb/a-b")
x1 = int(input("Type in the Value of x1: "))
x2 = int(input("Type in the Value of x2: "))
function = str(input("Type in the Function: "))
fa = int(input("Type in the Value of The Function When x1 Is The Value of x: "))
fb = int(input("Type in the Value of The Function When x2 Is The Value of x: "))
a = ((fa-fb)/(x1-x2))
a = str(a)
print ( "Average Rate of Change = "+ (a))
average_rate_of_change_calculator()

No comments:

Post a Comment