Skip to content

Instantly share code, notes, and snippets.

@idkaaa
Created September 27, 2017 17:25
Show Gist options
  • Save idkaaa/c1cac384763291e2d24e04afca7b58f9 to your computer and use it in GitHub Desktop.
Save idkaaa/c1cac384763291e2d24e04afca7b58f9 to your computer and use it in GitHub Desktop.
Simple python program to find the maximum value for discrete integers
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