Skip to content

Implicit function

1
fplot(fxy);

example_fimplicit_1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#include <matplot/matplot.h>

int main() {
    using namespace matplot;

    fimplicit([](double x, double y) { return pow(x, 2) - pow(y, 2) - 1; });

    show();
    return 0;
}

More examples

example_fimplicit_2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include <matplot/matplot.h>

int main() {
    using namespace matplot;

    fimplicit([](double x, double y) { return pow(x, 2) + pow(y, 2) - 3; },
              std::array<double, 4>{-3, 0, -2, 2});

    show();
    return 0;
}

example_fimplicit_3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <matplot/matplot.h>

int main() {
    using namespace matplot;

    fimplicit([](double x, double y) { return pow(x, 2) + pow(y, 2) - 1; });
    hold(on);
    fimplicit([](double x, double y) { return pow(x, 2) + pow(y, 2) - 2; },
              "--g")
        ->line_width(2);
    hold(off);

    show();
    return 0;
}

example_fimplicit_4

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <matplot/matplot.h>

int main() {
    using namespace matplot;

    fimplicit([](double x, double y) { return y * sin(x) + x * cos(y); })
        ->color("r")
        .line_style("--")
        .line_width(2);

    show();
    return 0;
}