aboutsummaryrefslogtreecommitdiffstats
path: root/240/main.cpp
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov2070@gmail.com>2025-04-14 00:34:52 +0300
committerjustanothercatgirl <sotov2070@gmail.com>2025-04-14 00:34:52 +0300
commit5ee716791bf7a8ca74c1670a6887a53ab92141f6 (patch)
tree0a5a522f89d258ec36f4af23cc60aaa578abe7e8 /240/main.cpp
parent320bf2f0155edd67557a3042403eeb843b90a41d (diff)
added 218, 226, 234, 240
Diffstat (limited to '240/main.cpp')
-rw-r--r--240/main.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/240/main.cpp b/240/main.cpp
new file mode 100644
index 0000000..52af396
--- /dev/null
+++ b/240/main.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+
+#include "include/praktable.hpp"
+#include "include/prakphys.hpp"
+
+using table = prak::table<f64>;
+using f64p = prak::pvalue<f64>;
+using f64v = std::vector<f64>;
+using vecarg = const std::vector<f64> &;
+using argvec = const std::vector<f64> &;
+
+void ex1(std::string file) {
+ table t(file);
+ t.apply([](argvec a){ return std::log(a[0]/a[1]); }, std::vector<std::string>{"dp1", "dp"}, "ln");
+ t.write_plot("mnk.plot", "t", "ln", std::nullopt);
+ auto [A, B] = t.least_squares_linear("t", "ln", std::nullopt, std::make_optional(0.1));
+ f64p gamma = prak::function<f64>([](vecarg a) { return std::exp(a[0]) / (std::exp(a[0]) - 1); }, {B});
+ f64p Cv = prak::R<f64> / (gamma - 1.0);
+ f64p i = 2.0 * Cv / prak::R<f64>, Cp = Cv + prak::R<f64>;
+ f64 m0 = 1.29 * 0.0127;
+ f64p alpha = m0 * Cp * A, tau = 1.0 / A;
+ std::cout << t var(A) var(B) var(gamma) var(Cv) var(i) var(m0) var(Cp) var(alpha) var(tau);
+}
+
+int main() {
+ ex1("data");
+ return 0;
+}