Created
September 18, 2025 02:36
-
-
Save mcblin/9ce4ed81c5dc684bb0ae9bb51ae3b0ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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 pandas as pd | |
| # Диапазоны | |
| X_vals = [x for x in range(-3, 4)] # задание массива | |
| Y_vals = [y * 1.5 for y in range(0, 7)] | |
| # Таблица | |
| rows = [] # задание массива | |
| for x, y in zip(X_vals, Y_vals): | |
| A = abs(x) <= 1 # условие | |
| B = (y - 3) >= 4 | |
| C = (x + y * y) > 7 | |
| # Импликация A→B | |
| Imp = (not A) or B | |
| # Отрицание C | |
| NotC = not C | |
| # Эквиваленция (A→B) <-> ¬C | |
| Eqv = (Imp == NotC) | |
| # Итог ((A→B)<->¬C) ∨ B | |
| FinalExpr = Eqv or B | |
| rows.append({ | |
| "X": x, | |
| "Y": y, | |
| "A: |X|<=1": A, | |
| "B: (Y-3)>=4": B, | |
| "C: (X+Y^2)>7": C, | |
| "A→B": Imp, | |
| "¬C": NotC, | |
| "(A→B)↔¬C": Eqv, | |
| "((A→B)↔¬C)∨B": FinalExpr | |
| }) | |
| df = pd.DataFrame(rows) | |
| df = df.replace({True: "1", False: "0"}) | |
| # print(df) #вывод таблицы в терминал | |
| df.to_excel("матлог_python.xlsx", index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment