| 2 | #include <matplot/matplot.h> |
| 3 | |
| 4 | int main() { |
| 5 | using namespace matplot; |
| 6 | |
| 7 | std::vector<double> x = linspace(-5, +5); |
| 8 | std::vector<double> y = |
| 9 | transform(x, [](auto x) { return pow(x, 3) - 12 * x; }); |
| 10 | plot(x, y); |
| 11 | |
| 12 | std::vector<double> xt = {-2, +2}; |
| 13 | std::vector<double> yt = {16, -16}; |
| 14 | std::string str = "dy/dx = 0"; |
| 15 | text(xt, yt, str); |
| 16 | |
| 17 | show(); |
| 18 | return 0; |
| 19 | } |