Created
September 27, 2017 17:25
-
-
Save idkaaa/c1cac384763291e2d24e04afca7b58f9 to your computer and use it in GitHub Desktop.
Simple python program to find the maximum value for discrete integers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
def OptimizedFunction(x): | |
return (math.pow((x%6), 2) % (7-math.sin(x))) | |
MaxValue = 0 | |
MaxIndex = 0 | |
for i in range(1,101): | |
print("i = " + str(i)) | |
Result = OptimizedFunction(i) | |
if (Result > MaxValue): | |
MaxValue = Result | |
MaxIndex = i | |
print("The largest value is: " + str(MaxValue) + " from the input of x: " + str(MaxIndex)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment