From 5ee716791bf7a8ca74c1670a6887a53ab92141f6 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Mon, 14 Apr 2025 00:34:52 +0300 Subject: added 218, 226, 234, 240 --- 226/main.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 226/main.cpp (limited to '226/main.cpp') diff --git a/226/main.cpp b/226/main.cpp new file mode 100644 index 0000000..9584e60 --- /dev/null +++ b/226/main.cpp @@ -0,0 +1,32 @@ +#include "include/praktable.hpp" +#include "include/prakphys.hpp" + +using table = prak::table; +using f64p = prak::pvalue; +using f64v = std::vector; +using vecarg = const std::vector &; +using argvec = const std::vector &; + +void ex1(std::string file) { + table t(file); + t .apply(prak::avg, {"T1", "T2", "T3"}, "T") + .apply([](vecarg a){ + return std::sqrt(std::pow(prak::stddev({a[0], a[1], a[2]}), 2) + + std::pow(prak::avg({a[3], a[4], a[5]}), 2)/3.0); + }, {"T1", "T2", "T3", "sT1", "sT2", "sT3"}, "sT") + .add_columns({"Tv", "sTv", "Te", "sTe"}) + .add_columns({"svpr", "sepr"}, 6e3) + .multiply_column("vpr", 1e3) + .multiply_column("epr", conv::eV_to_J) + .apply_function([](vecarg a){return prak::m_e * a[0] * a[0] / (2 * prak::k);}, {"vpr"}, {"svpr"}, "Tv", "sTv") + .apply_function([](vecarg a){return 2 * a[0] / prak::k;}, {"epr"}, {"sepr"}, "Te", "sTe") + .delete_cols({"svpr", "sepr", "sTe"}) + .write_plot("T(U).plot", "U", "T", "sT") + .write_plot("Tv(U).plot", "U", "Tv", "sTv") + .print(); +} + +int main() { + ex1("data"); + return 0; +} -- cgit v1.2.3-70-g09d2