Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <algebra_cxx14.hpp>
#include <cmath>
#include <iostream>
using namespace std;
using namespace algebra_cxx14::exports;
#define TAG(_name_) struct _name_ { static constexpr const char* name = #_name_; }
TAG(X);
TAG(Y);
TAG(Z);
int main()
{
const double c1 = 7.0, c2 = 3.0;
double x{}, y{}, z{};
auto varX = var<X>(x);
auto varY = var<Y>(y);
auto varZ = var<Z>(z);
auto fn1 = pow(c1, 1.3) + pow(varX, 2_c) - log(c1) * log(c2 - varY);
auto fn2 = c1 * pow(varX, 4_c) + c2 * pow(varX, 3_c) * pow(varY, 5_c) + pow(varZ, 2_c) + c2;
auto fn3 = exp(c2 - c1) - c1 / (log(varY) * pow(varZ, c2)) * (-c2);
cout
<< fn1 << '\n'
<< fn2 << '\n'
<< fn3 << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.