native-nao

0.0.4 • Public • Published

Documentation Status

Nao

Read the docs!

Nao is a math library.

Features

  • Scalar
    • Factorial
  • Matrices
    • Matrix solver
  • Vectors
  • Polynomials
    • Solvers for 1-4 degree polynomials
  • Distance
    • Distance of a line to a point
    • Test whether a point is outside a sphere

Build

make
# libraries will be in build/lib 

Example - main.c

#include <stdio.h>
#include "matrix.h"
#include "polynomial.h"
 
static void printm(const char * name, size_t size, double * m)
{
    printf("%s\t\t", name);
 
    for(size_t i = 0; i < size; i++)
        printf("%.2f\t", m[i]);
 
    puts("");
}
 
int main(int argc, char * argv[])
{
    double A[] = {11102525, -1}, B[] = {6, -427}, X[3] = {0};
    double poly[] = {1080,-126,-123,6,3};
    double x[4] = {0};
    matrix_solve(3, A, B, X);
 
    if(!polynomial_solve_degree_4(poly, x))
        printf("No results for the polynomial.\n");
 
    printm("A"9, A);
    printm("B"3, B);
    printm("X"3, X);
    printm("x"4, x);
    return 0;
}

Output

A		1.00	1.00	1.00	0.00	2.00	5.00	2.00	5.00	-1.00
B		6.00	-4.00	27.00
X		5.00	3.00	-2.00
x		-6.00	-4.00	3.00	5.00

Package Sidebar

Install

npm i native-nao

Weekly Downloads

0

Version

0.0.4

License

GPL-3.0

Last publish

Collaborators

  • wilhelm