#include "mex.h"
#include <math.h>

void ManifoldEquation (
  double *x,
  double *alpha,
  double omega,
  double *w1,
  double *w2,
  double *v1,
  double *v2,
  double g1,
  double g2,
  double *u,
  double *r,
  double residuum[27])
{
  residuum[0] = 0.1e-1 * cos(omega * alpha[0]) * v1[1] - 0.1e-1 * sin(omega * alpha[0]) * v2[1] - 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * v1[1] + 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * v2[1] + 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * v1[1] - 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * v2[1] - cos(omega * alpha[1]) * (0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * v1[3] + sin(omega * alpha[1]) * (0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * v2[3] - cos(omega * (alpha[1] + 0.12e2)) * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * v1[3] + sin(omega * (alpha[1] + 0.12e2)) * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * v2[3] + omega * v2[0] + g1 * w1[0] + g2 * w2[0];
  residuum[1] = -v1[0] + v1[1] + omega * v2[1] + g1 * w1[1] + g2 * w2[1];
  residuum[2] = 0.1e-1 * cos(omega * alpha[1]) * v1[3] - 0.1e-1 * sin(omega * alpha[1]) * v2[3] - 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * v1[3] + 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * v2[3] + 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * v1[3] - 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * v2[3] - cos(omega * alpha[2]) * (0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * v1[5] + sin(omega * alpha[2]) * (0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * v2[5] - cos(omega * (alpha[2] + 0.13e2)) * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * v1[5] + sin(omega * (alpha[2] + 0.13e2)) * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * v2[5] + omega * v2[2] + g1 * w1[2] + g2 * w2[2];
  residuum[3] = -v1[2] + v1[3] + omega * v2[3] + g1 * w1[3] + g2 * w2[3];
  residuum[4] = 0.1e-1 * cos(omega * alpha[2]) * v1[5] - 0.1e-1 * sin(omega * alpha[2]) * v2[5] - 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * v1[5] + 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * v2[5] + 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * v1[5] - 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * v2[5] + omega * v2[4] + g1 * w1[4] + g2 * w2[4];
  residuum[5] = -v1[4] + v1[5] + omega * v2[5] + g1 * w1[5] + g2 * w2[5];
  residuum[6] = 0.1e-1 * cos(omega * alpha[0]) * v2[1] + 0.1e-1 * sin(omega * alpha[0]) * v1[1] - 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * v2[1] - 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * v1[1] + 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * v2[1] + 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * v1[1] - cos(omega * alpha[1]) * (0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * v2[3] - sin(omega * alpha[1]) * (0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * v1[3] - cos(omega * (alpha[1] + 0.12e2)) * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * v2[3] - sin(omega * (alpha[1] + 0.12e2)) * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * v1[3] - omega * v1[0] + g1 * w2[0] + g2 * w1[0];
  residuum[7] = -v2[0] + v2[1] - omega * v1[1] + g1 * w2[1] + g2 * w1[1];
  residuum[8] = 0.1e-1 * cos(omega * alpha[1]) * v2[3] + 0.1e-1 * sin(omega * alpha[1]) * v1[3] - 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * v2[3] - 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * v1[3] + 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * v2[3] + 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * v1[3] - cos(omega * alpha[2]) * (0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * v2[5] - sin(omega * alpha[2]) * (0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * v1[5] - cos(omega * (alpha[2] + 0.13e2)) * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * v2[5] - sin(omega * (alpha[2] + 0.13e2)) * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * v1[5] - omega * v1[2] + g1 * w2[2] + g2 * w1[2];
  residuum[9] = -v2[2] + v2[3] - omega * v1[3] + g1 * w2[3] + g2 * w1[3];
  residuum[10] = 0.1e-1 * cos(omega * alpha[2]) * v2[5] + 0.1e-1 * sin(omega * alpha[2]) * v1[5] - 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * v2[5] - 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * v1[5] + 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * v2[5] + 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * v1[5] - omega * v1[4] + g1 * w2[4] + g2 * w1[4];
  residuum[11] = -v2[4] + v2[5] - omega * v1[5] + g1 * w2[5] + g2 * w1[5];
  residuum[12] = v1[0] * w1[0] + v1[1] * w1[1] + v1[2] * w1[2] + v1[3] * w1[3] + v1[4] * w1[4] + v1[5] * w1[5] + v2[0] * w2[0] + v2[1] * w2[1] + v2[2] * w2[2] + v2[3] * w2[3] + v2[4] * w2[4] + v2[5] * w2[5] + 0.1e1;
  residuum[13] = v1[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w1[0] * sin(omega * (alpha[1] + 0.12e2)) * (alpha[1] + 0.12e2) - v1[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w2[0] * cos(omega * (alpha[1] + 0.12e2)) * (alpha[1] + 0.12e2) + v2[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w2[0] * sin(omega * (alpha[1] + 0.12e2)) * (alpha[1] + 0.12e2) + v2[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w1[0] * cos(omega * (alpha[1] + 0.12e2)) * (alpha[1] + 0.12e2) + v1[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w1[2] * sin(omega * (alpha[2] + 0.13e2)) * (alpha[2] + 0.13e2) - v1[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w2[2] * cos(omega * (alpha[2] + 0.13e2)) * (alpha[2] + 0.13e2) + v2[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w2[2] * sin(omega * (alpha[2] + 0.13e2)) * (alpha[2] + 0.13e2) + v2[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w1[2] * cos(omega * (alpha[2] + 0.13e2)) * (alpha[2] + 0.13e2) + 0.1e0 * v1[3] * w2[2] * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[3] * w2[2] * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[3] * w1[2] * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1) + v1[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w1[2] - 0.1e-1 * w1[4]) * sin(omega * alpha[2]) * alpha[2] - v1[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w2[2] - 0.1e-1 * w2[4]) * cos(omega * alpha[2]) * alpha[2] + v2[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w2[2] - 0.1e-1 * w2[4]) * sin(omega * alpha[2]) * alpha[2] + v2[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w1[2] - 0.1e-1 * w1[4]) * cos(omega * alpha[2]) * alpha[2] + 0.1e-1 * v1[5] * w1[4] * sin(omega * (alpha[2] + alpha[5])) * (alpha[2] + alpha[5]) - 0.1e-1 * v1[1] * w1[0] * sin(omega * alpha[0]) * alpha[0] + 0.1e-1 * v1[1] * w2[0] * cos(omega * alpha[0]) * alpha[0] - 0.1e-1 * v2[1] * w2[0] * sin(omega * alpha[0]) * alpha[0] - 0.1e-1 * v2[1] * w1[0] * cos(omega * alpha[0]) * alpha[0] + 0.1e-1 * v1[1] * w1[0] * sin(omega * (alpha[0] + alpha[3])) * (alpha[0] + alpha[3]) - 0.1e-1 * v1[1] * w2[0] * cos(omega * (alpha[0] + alpha[3])) * (alpha[0] + alpha[3]) + 0.1e-1 * v2[1] * w2[0] * sin(omega * (alpha[0] + alpha[3])) * (alpha[0] + alpha[3]) + 0.1e-1 * v2[1] * w1[0] * cos(omega * (alpha[0] + alpha[3])) * (alpha[0] + alpha[3]) - 0.1e0 * v1[1] * w1[0] * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1) + 0.1e0 * v1[1] * w2[0] * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[1] * w2[0] * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1) - 0.1e-1 * v1[5] * w2[4] * cos(omega * (alpha[2] + alpha[5])) * (alpha[2] + alpha[5]) + 0.1e-1 * v2[5] * w2[4] * sin(omega * (alpha[2] + alpha[5])) * (alpha[2] + alpha[5]) + 0.1e-1 * v2[5] * w1[4] * cos(omega * (alpha[2] + alpha[5])) * (alpha[2] + alpha[5]) - 0.1e0 * v1[5] * w1[4] * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1) + 0.1e0 * v1[5] * w2[4] * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[5] * w2[4] * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[5] * w1[4] * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1) - 0.1e0 * v2[1] * w1[0] * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1) + v1[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w1[0] - 0.1e-1 * w1[2]) * sin(omega * alpha[1]) * alpha[1] - v1[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w2[0] - 0.1e-1 * w2[2]) * cos(omega * alpha[1]) * alpha[1] + v2[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w2[0] - 0.1e-1 * w2[2]) * sin(omega * alpha[1]) * alpha[1] + v2[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w1[0] - 0.1e-1 * w1[2]) * cos(omega * alpha[1]) * alpha[1] + 0.1e-1 * v1[3] * w1[2] * sin(omega * (alpha[1] + alpha[4])) * (alpha[1] + alpha[4]) - 0.1e-1 * v1[3] * w2[2] * cos(omega * (alpha[1] + alpha[4])) * (alpha[1] + alpha[4]) + 0.1e-1 * v2[3] * w2[2] * sin(omega * (alpha[1] + alpha[4])) * (alpha[1] + alpha[4]) + 0.1e-1 * v2[3] * w1[2] * cos(omega * (alpha[1] + alpha[4])) * (alpha[1] + alpha[4]) - 0.1e0 * v1[3] * w1[2] * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1) + v2[0] * w1[0] + v2[1] * w1[1] + v2[2] * w1[2] + v2[3] * w1[3] + v2[4] * w1[4] + v2[5] * w1[5] - v1[0] * w2[0] - v1[1] * w2[1] - v1[2] * w2[2] - v1[3] * w2[3] - v1[4] * w2[4] - v1[5] * w2[5];
  residuum[14] = -0.1e0 * u[1] - 0.1666666667e-3 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w1[0] * pow(0.1e1 - exp(-x[0] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[0] / 0.90000e5) + 0.1666666667e-3 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w2[0] * pow(0.1e1 - exp(-x[0] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[0] / 0.90000e5) - 0.1666666667e-3 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w2[0] * pow(0.1e1 - exp(-x[0] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[0] / 0.90000e5) - 0.1666666667e-3 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w1[0] * pow(0.1e1 - exp(-x[0] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[0] / 0.90000e5) + (0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * u[3] + (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * u[3];
  residuum[15] = u[0] - u[1];
  residuum[16] = -0.1e0 * u[3] - 0.1666666667e-3 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w1[2] * pow(0.1e1 - exp(-x[2] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[2] / 0.90000e5) + 0.1666666667e-3 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w2[2] * pow(0.1e1 - exp(-x[2] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[2] / 0.90000e5) - 0.1666666667e-3 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w2[2] * pow(0.1e1 - exp(-x[2] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[2] / 0.90000e5) - 0.1666666667e-3 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w1[2] * pow(0.1e1 - exp(-x[2] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[2] / 0.90000e5) + (0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * u[5] + (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * u[5];
  residuum[17] = u[2] - u[3];
  residuum[18] = -0.1e0 * u[5] - 0.1666666667e-3 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w1[4] * pow(0.1e1 - exp(-x[4] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[4] / 0.90000e5) + 0.1666666667e-3 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w2[4] * pow(0.1e1 - exp(-x[4] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[4] / 0.90000e5) - 0.1666666667e-3 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w2[4] * pow(0.1e1 - exp(-x[4] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[4] / 0.90000e5) - 0.1666666667e-3 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w1[4] * pow(0.1e1 - exp(-x[4] / 0.90000e5), -0.1e1 / 0.2e1) * exp(-x[4] / 0.90000e5);
  residuum[19] = u[4] - u[5];
  residuum[20] = -0.1e-1 * sin(omega * alpha[0]) * omega * v1[1] * w1[0] + 0.1e-1 * cos(omega * alpha[0]) * omega * v1[1] * w2[0] - 0.1e-1 * sin(omega * alpha[0]) * omega * v2[1] * w2[0] - 0.1e-1 * cos(omega * alpha[0]) * omega * v2[1] * w1[0] + 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * omega * v1[1] * w1[0] - 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * omega * v1[1] * w2[0] + 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * omega * v2[1] * w2[0] + 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * omega * v2[1] * w1[0] - 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w1[0] + 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w2[0] - 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w2[0] - 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w1[0] + r[0];
  residuum[21] = sin(omega * alpha[1]) * omega * v1[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w1[0] - 0.1e-1 * w1[2]) - cos(omega * alpha[1]) * omega * v1[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w2[0] - 0.1e-1 * w2[2]) + sin(omega * alpha[1]) * omega * v2[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w2[0] - 0.1e-1 * w2[2]) + cos(omega * alpha[1]) * omega * v2[3] * ((0.1666666667e-1 - 0.8333333333e-3 * alpha[4]) * w1[0] - 0.1e-1 * w1[2]) + 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * omega * v1[3] * w1[2] - 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * omega * v1[3] * w2[2] + 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * omega * v2[3] * w2[2] + 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * omega * v2[3] * w1[2] - 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w1[2] + 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w2[2] - 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w2[2] - 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w1[2] + sin(omega * (alpha[1] + 0.12e2)) * omega * v1[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w1[0] - cos(omega * (alpha[1] + 0.12e2)) * omega * v1[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w2[0] + sin(omega * (alpha[1] + 0.12e2)) * omega * v2[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w2[0] + cos(omega * (alpha[1] + 0.12e2)) * omega * v2[3] * (0.1e1 / 0.12e2 + 0.8333333333e-3 * alpha[4]) * w1[0] + r[1];
  residuum[22] = sin(omega * alpha[2]) * omega * v1[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w1[2] - 0.1e-1 * w1[4]) - cos(omega * alpha[2]) * omega * v1[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w2[2] - 0.1e-1 * w2[4]) + sin(omega * alpha[2]) * omega * v2[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w2[2] - 0.1e-1 * w2[4]) + cos(omega * alpha[2]) * omega * v2[5] * ((0.2307692308e-1 - 0.7692307692e-3 * alpha[5]) * w1[2] - 0.1e-1 * w1[4]) + 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * omega * v1[5] * w1[4] - 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * omega * v1[5] * w2[4] + 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * omega * v2[5] * w2[4] + 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * omega * v2[5] * w1[4] - 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w1[4] + 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w2[4] - 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w2[4] - 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w1[4] + sin(omega * (alpha[2] + 0.13e2)) * omega * v1[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w1[2] - cos(omega * (alpha[2] + 0.13e2)) * omega * v1[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w2[2] + sin(omega * (alpha[2] + 0.13e2)) * omega * v2[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w2[2] + cos(omega * (alpha[2] + 0.13e2)) * omega * v2[5] * (0.1e1 / 0.13e2 + 0.7692307692e-3 * alpha[5]) * w1[2] + r[2];
  residuum[23] = 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * omega * v1[1] * w1[0] - 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * omega * v1[1] * w2[0] + 0.1e-1 * sin(omega * (alpha[0] + alpha[3])) * omega * v2[1] * w2[0] + 0.1e-1 * cos(omega * (alpha[0] + alpha[3])) * omega * v2[1] * w1[0] - 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w1[0] + 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v1[1] * w2[0] - 0.1e0 * sin(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w2[0] - 0.1e0 * cos(omega * (alpha[0] + alpha[3] + 0.300e3 * sqrt(0.1e1 - exp(-x[0] / 0.90000e5)) + 0.1e1)) * omega * v2[1] * w1[0] + r[3];
  residuum[24] = 0.8333333333e-3 * cos(omega * alpha[1]) * v1[3] * w1[0] + 0.8333333333e-3 * sin(omega * alpha[1]) * v1[3] * w2[0] + 0.8333333333e-3 * cos(omega * alpha[1]) * v2[3] * w2[0] - 0.8333333333e-3 * sin(omega * alpha[1]) * v2[3] * w1[0] + 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * omega * v1[3] * w1[2] - 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * omega * v1[3] * w2[2] + 0.1e-1 * sin(omega * (alpha[1] + alpha[4])) * omega * v2[3] * w2[2] + 0.1e-1 * cos(omega * (alpha[1] + alpha[4])) * omega * v2[3] * w1[2] - 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w1[2] + 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v1[3] * w2[2] - 0.1e0 * sin(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w2[2] - 0.1e0 * cos(omega * (alpha[1] + alpha[4] + 0.300e3 * sqrt(0.1e1 - exp(-x[2] / 0.90000e5)) + 0.1e1)) * omega * v2[3] * w1[2] - 0.8333333333e-3 * cos(omega * (alpha[1] + 0.12e2)) * v1[3] * w1[0] - 0.8333333333e-3 * sin(omega * (alpha[1] + 0.12e2)) * v1[3] * w2[0] - 0.8333333333e-3 * cos(omega * (alpha[1] + 0.12e2)) * v2[3] * w2[0] + 0.8333333333e-3 * sin(omega * (alpha[1] + 0.12e2)) * v2[3] * w1[0] + r[4];
  residuum[25] = 0.7692307692e-3 * cos(omega * alpha[2]) * v1[5] * w1[2] + 0.7692307692e-3 * sin(omega * alpha[2]) * v1[5] * w2[2] + 0.7692307692e-3 * cos(omega * alpha[2]) * v2[5] * w2[2] - 0.7692307692e-3 * sin(omega * alpha[2]) * v2[5] * w1[2] + 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * omega * v1[5] * w1[4] - 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * omega * v1[5] * w2[4] + 0.1e-1 * sin(omega * (alpha[2] + alpha[5])) * omega * v2[5] * w2[4] + 0.1e-1 * cos(omega * (alpha[2] + alpha[5])) * omega * v2[5] * w1[4] - 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w1[4] + 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v1[5] * w2[4] - 0.1e0 * sin(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w2[4] - 0.1e0 * cos(omega * (alpha[2] + alpha[5] + 0.300e3 * sqrt(0.1e1 - exp(-x[4] / 0.90000e5)) + 0.1e1)) * omega * v2[5] * w1[4] - 0.7692307692e-3 * cos(omega * (alpha[2] + 0.13e2)) * v1[5] * w1[2] - 0.7692307692e-3 * sin(omega * (alpha[2] + 0.13e2)) * v1[5] * w2[2] - 0.7692307692e-3 * cos(omega * (alpha[2] + 0.13e2)) * v2[5] * w2[2] + 0.7692307692e-3 * sin(omega * (alpha[2] + 0.13e2)) * v2[5] * w1[2] + r[5];
  residuum[26] = 0.1e0 * u[1] + r[6];
}


/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
     
 /* check for proper number of arguments */
 if(nrhs!=12) {
     mexErrMsgIdAndTxt("MyToolbox:GenEigManiPop:nrhs","12 inputs required (some of them are vectors).");
 }
 if(nlhs==0) {
     mexErrMsgIdAndTxt("MyToolbox:GenEigManiPop:nlhs","Please define an output!");
 }
 if(nlhs!=1) {
     mexErrMsgIdAndTxt("MyToolbox:GenEigManiPop:nlhs","One output required.");
 }
  
 /* get the values of the inputs
  * scalars are fetched using mxGetScalar and assigned to a type double,
  * vectors are fetched using mxGetPr and assigned to type double pointer
  */
 
 double *xPointer = mxGetPr(prhs[0]);
 double *alphaPointer = mxGetPr(prhs[1]);
 double *pPointer = mxGetPr(prhs[2]);
 double omega = mxGetScalar(prhs[3]);
 double *w1Pointer = mxGetPr(prhs[4]);
 double *w2Pointer = mxGetPr(prhs[5]);
 double *v1Pointer = mxGetPr(prhs[6]);
 double *v2Pointer = mxGetPr(prhs[7]);
 double g1 = mxGetScalar(prhs[8]);
 double g2 = mxGetScalar(prhs[9]);
 double *uPointer = mxGetPr(prhs[10]);
 double *rPointer = mxGetPr(prhs[11]);
 

 

 /* create the output matrix */
 plhs[0] = mxCreateDoubleMatrix(1,(mwSize)27,mxREAL);

 /* get a pointer to the real data in the output matrix */
 double *residuumPointer = mxGetPr(plhs[0]);

 /* call the computational routine */
 ManifoldEquation(xPointer,alphaPointer,omega,w1Pointer,w2Pointer,v1Pointer,
         v2Pointer,g1,g2,uPointer,rPointer,residuumPointer);
}