aboutsummaryrefslogtreecommitdiffstats
path: root/218
diff options
context:
space:
mode:
Diffstat (limited to '218')
-rw-r--r--218/Makefile18
-rw-r--r--218/README.md5
-rw-r--r--218/compile_flags.txt4
-rw-r--r--218/data8
l---------218/include1
-rw-r--r--218/main.cpp19
-rw-r--r--218/plots.gp16
7 files changed, 71 insertions, 0 deletions
diff --git a/218/Makefile b/218/Makefile
new file mode 100644
index 0000000..224506f
--- /dev/null
+++ b/218/Makefile
@@ -0,0 +1,18 @@
+
+CFLAGS = -std=c++2c -mavx -Iinclude -ggdb
+
+.PHONY: all run_main clean gnuplot
+
+run: gnuplot
+
+gnuplot: plots.gp run_main
+ gnuplot $< &>/dev/null
+
+run_main: main
+ ./main
+
+main: main.cpp include/*
+ $(CXX) -o $@ $< $(CFLAGS)
+
+clean:
+ rm -fr main *.png *.plot
diff --git a/218/README.md b/218/README.md
new file mode 100644
index 0000000..96fd716
--- /dev/null
+++ b/218/README.md
@@ -0,0 +1,5 @@
+<!-- Шаблон для прака -->
+<!-- файлы, заканчивающиеся на .plot считаются генерируемыми и удаляются через make clean -->
+# Обработка <> прака
+
+
diff --git a/218/compile_flags.txt b/218/compile_flags.txt
new file mode 100644
index 0000000..34ae930
--- /dev/null
+++ b/218/compile_flags.txt
@@ -0,0 +1,4 @@
+-Iinclude
+-std=c++2c
+-mavx2
+
diff --git a/218/data b/218/data
new file mode 100644
index 0000000..fe6e835
--- /dev/null
+++ b/218/data
@@ -0,0 +1,8 @@
+dp dt
+215 7.9
+178 9.5
+150 10.2
+133 11.2
+96 13
+75 15
+56 18
diff --git a/218/include b/218/include
new file mode 120000
index 0000000..2225752
--- /dev/null
+++ b/218/include
@@ -0,0 +1 @@
+../libprakpp/include/ \ No newline at end of file
diff --git a/218/main.cpp b/218/main.cpp
new file mode 100644
index 0000000..379804a
--- /dev/null
+++ b/218/main.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+#include "include/praktable.hpp"
+#include "include/prakphys.hpp"
+
+int main() {
+ prak::table<f64> t("data");
+ t .add_column("1/dt")
+ .apply(prak::inv<f64>, "dt", "1/dt")
+ .write_plot("1dt(dp).plot", "dp", "1/dt", std::nullopt)
+ .print();
+ auto [A, B] = t.least_squares_linear("dp", "1/dt", std::nullopt, 0.00001);
+ f64 W = 3.82;
+ prak::pvalue<f64> beta = {1.51e-6, 0.05e-6}, T0 = {298.5, 1}, p0 = {0.99e5, 500},
+ CPR = A * W * T0 / beta / p0, CP = CPR * prak::R<f64>,
+ CVR = CPR - 1.0, CV = CVR * prak::R<f64>, i = 2.0*CV/prak::R<f64>;
+
+ std::cout var(A) var(B) var(beta) var(p0) var(CPR) var(CP) var(CVR) var(CV) var(i) << std::endl;
+ return 0;
+}
diff --git a/218/plots.gp b/218/plots.gp
new file mode 100644
index 0000000..eb9516c
--- /dev/null
+++ b/218/plots.gp
@@ -0,0 +1,16 @@
+set term pngcairo size 1000, 800
+set grid
+
+f1(x) = a1*x+b1
+fit f1(x) '1dt(dp).plot' via a1, b1
+
+set output '1dt(dp).png'
+set title "График зависимости велечины, обратной температуре воздуха, от разницы давлений"
+set xlabel "1/T (1/К)"
+set ylabel "P (Па)"
+set key top left
+
+set label sprintf("A = %.4g\n B = %.4g", a1, b1) at graph 0.2, 0.9 front boxed
+plot '1dt(dp).plot' notitle lc 0 pt 1 lw 2, \
+ f1(x) title "1/dT(dP)" lc rgb "red"
+