Esempio n. 1
0
def graph():

    if (request.method == "POST"):
        cidade = request.form.get('cidade')
        combustivel = request.form.get('combustível')
        x, y = f.build_graph(cidade, combustivel)
        grafo = f.graph(x, y)
        return render_template('graph.html', graph1=grafo)
Esempio n. 2
0
            lower, upper, int(num_elements)
        )  # generate a random sequence given the upper and lower bound
        indices, longest_seq = c.longest_subsequence(
            seq, limit)  # find the longest subsequence
    else:  # user provided a sequence, e.g. 1/n
        seq = f.generate_specific_sequence(
            sequence, int(num_elements)
        )  # generate the sequence using the sequence definition provided by user
        indices, longest_seq = c.longest_subsequence(
            seq, limit)  # find the longest subsequence

    num_args = len(sys.argv)
    if (num_args > 1):  # user provided a command line argument
        if str(sys.argv[1]
               ) == "p":  # check if first command line argument was p
            print("Longest Sequence: ", longest_seq)
        elif str(sys.argv[1]) == "g":
            f.graph(indices, longest_seq, seq)
    if (num_args == 3):  # user provided 2 command line arguments
        if (str(sys.argv[2]) == "g"
            ):  # check if second command line argument was g
            f.graph(indices, longest_seq, seq)
except RecursionError as err:
    print(
        "A RecursionError ocurred when finding the longest sequence. Please choose a less intensive sequence as described in the README."
    )
except:
    print(
        "An error ocurred. Check your input format.\nCheck all command line arguments and inputs adhere to specifications in the README."
    )
Esempio n. 3
0
def endgame():
    max_total = max(TOTALS)
    print "Highest Total is", max_total 
    print functions.graph(TOTALS, PLAYERS)
Esempio n. 4
0
# # plot states
# dc = data.state_renda.copy()
# dc.set_index('Estado', inplace=True)
# years = functions.years(dc)
# for values in dc.values:
#   plt.plot(years, np.delete(values, [0,1]))

# plt.title("Income by state")
# plt.xlabel("Year")
# plt.ylabel("Per capita monthly family income")
# plt.legend(dc.index.astype(str), loc='center left', bbox_to_anchor=(1, 0.5), prop = fontP)

# plt.show()

# state renda
functions.graph(data.state_renda, "Figure 2: Income by state", "Year",
                "Per capita monthly family income (average)", "Estado")

# state ensino
functions.graph(data.state_ensino, "Figure 3: Years of schooling by state",
                "Year of census", "Years of schooling (average)", "Estado")

# state saude
functions.graph(data.state_saude, "Figure 1: Infant mortality", "Year",
                "Deaths per 1000 births", "Estado")

# descriptive statistics on data
# df = data.state_saude.drop(['Código','Sigla'], axis=1)
# df.loc['mean'] = df.mean()
# df['Estado']['mean'] = 'Mean'

# print(tabulate(df, headers='keys', tablefmt='latex', showindex=False, floatfmt=".2f"))
Esempio n. 5
0
# Salary Calculator
# by Daniel Goldenberg
# -----------------------------------------------------------------

import functions

functions.info()
functions.introduction()
functions.calculator()

functions.graph()
Esempio n. 6
0
            lot = myline[4]

            if entry:
                try:
                    exittime = dt.datetime.strptime(myline[1], datetimeformat4)
                    entrytime = dt.datetime.strptime(entry, datetimeformat4)
                except:
                    exittime = dt.datetime.strptime(myline[1], datetimeformat2)
                    entrytime = dt.datetime.strptime(entry, datetimeformat2)                    
                entryminutes = entrytime.hour * 60 + entrytime.minute
                exitminutes = exittime.hour * 60 + exittime.minute
                if (i % 100000) == 0:
                    print("On line: " + str(i))


                if entryminutes > exitminutes:
                    # entered before midnight, left after midnight
                    for x in range(entryminutes, minutes_in_a_day):
                        byLot = add_key(byLot, entrytime.strftime('%A'), lot)
                        byLot[entrytime.strftime('%A')][lot][x] += 1
                    for x in range(0, exitminutes):
                        byLot = add_key(byLot, exittime.strftime('%A'), lot)
                        byLot[exittime.strftime('%A')][lot][x] += 1
                else:
                    for x in range(entryminutes,exitminutes):
                        byLot = add_key(byLot, entrytime.strftime('%A'), lot)
                        byLot[entrytime.strftime('%A')][lot][x] += 1

graph(byLot, lots)

Esempio n. 7
0
    pred_znach = sled_znach
    sled_znach = pred_znach + h
    a += h
    #Проверка на наличие корней на данном отрезке.
    if (fc.func(pred_znach) * fc.func(sled_znach) < 0) or (fc.func(pred_znach) == 0) \
       or (fc.func(sled_znach) == 0):
        x0 = pred_znach
        x1 = sled_znach
        proverca_1 = fc.second_proizv(x0)
        proverca_2 = fc.second_proizv(x1)
        #Уточнение корней.
        #print(proverca_1,proverca_2)
        if proverca_1:
            number_of_root += 1
            fc.utochnenie(proverca_1, x1, eps1, n, number_of_root, pred_znach,
                          sled_znach, error, c, h, d)
            error = 0
        elif proverca_2:
            number_of_root += 1
            fc.utochnenie(proverca_1, x1, eps1, n, number_of_root, pred_znach,
                          sled_znach, error, c, h, d)
            error = 0
        elif not proverca_1 and not proverca_2:
            number_of_root += 1
            #print(x0,x1)
            fc.utochnenie(proverca_1, x0, eps1, n, number_of_root, pred_znach,
                          sled_znach, error, c, h, d)

#Вторая часть задания.
fc.graph(d, c)
import functions

print("This is the test for the linear function")
print("\n")
#This is the test for the function of solving linear equations.

print('x =', functions.linear())

print("\n")

#This is the test for the function of solving quadratic equations.
print("This is the test for the function of quadratic equations")
print("\n")
print(functions.quadratic())

#This is the test for graphing a 2D equation.
functions.graph(4, 8, 50)