-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
458 additions
and
158 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Mac", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"macFrameworkPath": [ | ||
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" | ||
], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c17", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "macos-clang-x64" | ||
} | ||
], | ||
"version": 4 | ||
} |
22 changes: 22 additions & 0 deletions
22
computational-methods-and-simulation/lab-5/task-1/Makefile
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Nazwa pliku wykonywalnego | ||
EXEC = rectangle_integration | ||
|
||
# Flagi kompilacji | ||
CFLAGS = -Wall -lm | ||
|
||
# Pliki źródłowe | ||
SRC = rectangle_integration.c | ||
|
||
# Reguła główna | ||
all: $(EXEC) | ||
|
||
# Kompilacja programu | ||
$(EXEC): $(SRC) | ||
$(CC) $(CFLAGS) -o $(EXEC) $(SRC) | ||
|
||
# Czyszczenie plików wykonywalnych | ||
clean: | ||
rm -f $(EXEC) | ||
|
||
run: $(EXEC) | ||
./$(EXEC) |
Binary file added
BIN
+16.1 KB
computational-methods-and-simulation/lab-5/task-1/diagram/f1-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.8 KB
computational-methods-and-simulation/lab-5/task-1/diagram/f2-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions
107
computational-methods-and-simulation/lab-5/task-1/diagram/main.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# import matplotlib.pyplot as plt | ||
# import numpy as np | ||
|
||
# # Dane do wykresu | ||
# functions = [ | ||
# { | ||
# "name": "f1(x) = x^2 + x + 1", | ||
# "exact_value": 1.6666666667, | ||
# "approx_values": [1.8333314260, 1.8333314260, 1.8333314260, 1.8333314260], | ||
# "errors": [0.1666647593, 0.1666647593, 0.1666647593, 0.1666647593], | ||
# "subintervals": [1048576, 1048576, 1048576, 1048576] | ||
# }, | ||
# { | ||
# "name": "f2(x) = sqrt(1 - x^2)", | ||
# "exact_value": 0.7853981634, | ||
# "approx_values": [0.7863493507, 0.7854588020, 0.7854057753, 0.7853991163], | ||
# "errors": [0.0009511873, 0.0000606386, 0.0000076119, 0.0000009529], | ||
# "subintervals": [512, 8192, 65536, 524288] | ||
# }, | ||
# { | ||
# "name": "f3(x) = 1/sqrt(x)", | ||
# "exact_value": 2.0000000000, | ||
# "approx_values": [1.9800945559, 1.9800945559, 1.9800945559, 1.9800945559], | ||
# "errors": [0.0199054441, 0.0199054441, 0.0199054441, 0.0199054441], | ||
# "subintervals": [1048576, 1048576, 1048576, 1048576] | ||
# } | ||
# ] | ||
|
||
# # Ustawienia wykresów | ||
# fig, axs = plt.subplots(3, 2, figsize=(14, 10)) | ||
# fig.suptitle("Wyniki przybliżonej całki dla różnych funkcji", fontsize=16) | ||
|
||
# # Generowanie wykresów | ||
# for i, func in enumerate(functions): | ||
# # Podprzedziały vs Przybliżona całka | ||
# axs[i, 0].plot(func["subintervals"], func["approx_values"], marker='o', color='b', label="Przybliżona całka") | ||
# axs[i, 0].axhline(y=func["exact_value"], color='r', linestyle='--', label="Dokładna wartość") | ||
# axs[i, 0].set_xscale("log") | ||
# axs[i, 0].set_xlabel("Podprzedziały (log scale)") | ||
# axs[i, 0].set_ylabel("Wartość całki") | ||
# axs[i, 0].set_title(f"{func['name']}") | ||
# axs[i, 0].legend() | ||
|
||
# # Podprzedziały vs Błąd | ||
# axs[i, 1].plot(func["subintervals"], func["errors"], marker='o', color='g', label="Błąd") | ||
# axs[i, 1].set_xscale("log") | ||
# axs[i, 1].set_yscale("log") | ||
# axs[i, 1].set_xlabel("Podprzedziały (log scale)") | ||
# axs[i, 1].set_ylabel("Błąd (log scale)") | ||
# axs[i, 1].set_title(f"Błąd dla {func['name']}") | ||
# axs[i, 1].legend() | ||
|
||
# plt.tight_layout(rect=[0, 0, 1, 0.96]) | ||
# plt.show() | ||
|
||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# Dane do wykresu | ||
functions = [ | ||
{ | ||
"name": "f1(x) = x^2 + x + 1", | ||
"exact_value": 1.6666666667, | ||
"approx_values": [1.8333314260, 1.8333314260, 1.8333314260, 1.8333314260], | ||
"errors": [0.1666647593, 0.1666647593, 0.1666647593, 0.1666647593], | ||
"subintervals": [1048576, 1048576, 1048576, 1048576] | ||
}, | ||
{ | ||
"name": "f2(x) = sqrt(1 - x^2)", | ||
"exact_value": 0.7853981634, | ||
"approx_values": [0.7863493507, 0.7854588020, 0.7854057753, 0.7853991163], | ||
"errors": [0.0009511873, 0.0000606386, 0.0000076119, 0.0000009529], | ||
"subintervals": [512, 8192, 65536, 524288] | ||
}, | ||
{ | ||
"name": "f3(x) = 1/sqrt(x)", | ||
"exact_value": 2.0000000000, | ||
"approx_values": [1.9800945559, 1.9800945559, 1.9800945559, 1.9800945559], | ||
"errors": [0.0199054441, 0.0199054441, 0.0199054441, 0.0199054441], | ||
"subintervals": [1048576, 1048576, 1048576, 1048576] | ||
} | ||
] | ||
|
||
# Generowanie oddzielnych wykresów | ||
for func in functions: | ||
# Wykres Przybliżonej całki | ||
plt.figure() | ||
plt.plot(func["subintervals"], func["approx_values"], marker='o', color='b', label="Przybliżona całka") | ||
plt.axhline(y=func["exact_value"], color='r', linestyle='--', label="Dokładna wartość") | ||
plt.xscale("log") | ||
plt.xlabel("Podprzedziały (log scale)") | ||
plt.ylabel("Wartość całki") | ||
plt.title(f"{func['name']}") | ||
plt.legend() | ||
plt.show() | ||
|
||
# Wykres Błędu | ||
plt.figure() | ||
plt.plot(func["subintervals"], func["errors"], marker='o', color='g', label="Błąd") | ||
plt.xscale("log") | ||
plt.yscale("log") | ||
plt.xlabel("Podprzedziały (log scale)") | ||
plt.ylabel("Błąd (log scale)") | ||
plt.title(f"Błąd dla {func['name']}") | ||
plt.legend() | ||
plt.show() |
Binary file added
BIN
+48.5 KB
computational-methods-and-simulation/lab-5/task-1/rectangle_integration
Binary file not shown.
23 changes: 23 additions & 0 deletions
23
computational-methods-and-simulation/lab-5/task-2/Makefile
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Nazwa pliku wykonywalnego | ||
EXEC = calculate_integrals_gsl | ||
|
||
# Flagi kompilacji | ||
CFLAGS = -Wall | ||
LDFLAGS = -lgsl -lgslcblas -lm | ||
|
||
# Pliki źródłowe | ||
SRC = calculate_integrals_gsl.c | ||
|
||
# Reguła główna | ||
all: $(EXEC) | ||
|
||
# Kompilacja programu | ||
$(EXEC): $(SRC) | ||
$(CC) $(CFLAGS) -o $(EXEC) $(SRC) $(LDFLAGS) | ||
|
||
# Czyszczenie plików wykonywalnych | ||
clean: | ||
rm -f $(EXEC) | ||
|
||
run: $(EXEC) | ||
./$(EXEC) |
Binary file added
BIN
+49.2 KB
computational-methods-and-simulation/lab-5/task-2/calculate_integrals_gsl
Binary file not shown.
Binary file added
BIN
+44.5 KB
computational-methods-and-simulation/lab-5/task-2/diagram/Figure_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
computational-methods-and-simulation/lab-5/task-2/diagram/main.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
# Dane wejściowe | ||
epsrel_values = [1e-3, 1e-4, 1e-5, 1e-6] | ||
functions = { | ||
"f3: sin(x)": { | ||
"GSL": [2.0, 2.0, 2.0, 2.0], | ||
"Rectangular": [2.0002008117, 2.0000125499, 2.0000031375, 2.0000001961] | ||
}, | ||
"f4: tan(x)": { | ||
"GSL": [13.8155086985, 13.8155105592, 13.8155105579, 13.8155105579], | ||
"Rectangular": [13.8154192810, 13.8154877322, 13.8155091312, 13.8155104688] | ||
}, | ||
"f5: log(x + x^2)": { | ||
"GSL": [6.2060726455, 6.2060726455, 6.2060726455, 6.2060726455], | ||
"Rectangular": [6.2061687630, 6.2060966773, 6.2060741476, 6.2060727394] | ||
} | ||
} | ||
|
||
# Generowanie wykresów pojedynczo dla każdej funkcji | ||
for func_name, results in functions.items(): | ||
plt.figure(figsize=(8, 5)) | ||
|
||
# Wykres wyników GSL | ||
plt.plot(epsrel_values, results["GSL"], marker='o', color='b', label='GSL') | ||
|
||
# Wykres wyników Metody Prostokątów | ||
plt.plot(epsrel_values, results["Rectangular"], marker='x', color='r', label='Rectangular') | ||
|
||
# Konfiguracja wykresu | ||
plt.xscale("log") | ||
plt.xlabel("epsrel (Dokładność)") | ||
plt.ylabel("Wynik całki") | ||
plt.title(f"Wyniki dla {func_name}") | ||
plt.legend() | ||
plt.grid(True, which="both", linestyle="--", linewidth=0.5) | ||
|
||
# Wyświetlanie wykresu | ||
plt.show() |
Submodule 18.10.2024-car-rent-maven
added at
1f3e1c
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
3 changes: 1 addition & 2 deletions
3
java-advance/rent-car-maven/src/main/java/pl/edu/wszib/car/rent/App.java
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
27 changes: 0 additions & 27 deletions
27
...ance/rent-car-maven/src/main/java/pl/edu/wszib/car/rent/authentication/Authenticator.java
This file was deleted.
Oops, something went wrong.
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
27 changes: 27 additions & 0 deletions
27
...rent-car-maven/src/main/java/pl/edu/wszib/car/rent/authentication/impl/Authenticator.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package pl.edu.wszib.car.rent.authentication.impl; | ||
|
||
import org.apache.commons.codec.digest.DigestUtils; | ||
import pl.edu.wszib.car.rent.authentication.IAuthenticator; | ||
import pl.edu.wszib.car.rent.db.impl.UserRepository; | ||
import pl.edu.wszib.car.rent.model.User; | ||
|
||
public class Authenticator implements IAuthenticator { | ||
private static Authenticator instance = new Authenticator(); | ||
private UserRepository userRepository = UserRepository.getInstance(); | ||
private String seed = "sy2eL273fTUxQoH3Zlm7wM4ZzK3bR4Gh"; | ||
|
||
private Authenticator() { | ||
} | ||
|
||
@Override | ||
public boolean authenticate(User user) { | ||
User userFromDb = this.userRepository.getUser(user.getLogin()); | ||
return userFromDb != null && | ||
userFromDb.getPassword() | ||
.equals(DigestUtils.md5Hex(user.getPassword()+seed)); | ||
} | ||
|
||
public static Authenticator getInstance() { | ||
return instance; | ||
} | ||
} |
21 changes: 14 additions & 7 deletions
21
...java/pl/edu/wszib/car/rent/core/Core.java → ...pl/edu/wszib/car/rent/core/impl/Core.java
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
42 changes: 0 additions & 42 deletions
42
java-advance/rent-car-maven/src/main/java/pl/edu/wszib/car/rent/db/CarRepository.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.