Code Monkey home page Code Monkey logo

reduced-dnf's Introduction

Reduced Disjunctive Normal Form

This module allows to find a reduced DNF.

Install

To install this module you need to use NPM

npm install reduced-dnf

Usage

f(x1,x2,x3,x4)|_1=U(0,1,2,3,4,5,7,13,15)

If you've got a function of 4 arguments and points {0,1,2,3,4,5,7,13,15} where the function takes true-defined value (meaning 1), then you can get a reduced DNF function using this:

let dnf = require("reduced-dnf");
let data = dnf(["x_1","x_2","x_3","x_4"], [0,1,2,3,4,5,7,13,15]);

data.columns.forEach((column, i) => {
  console.log("Column no." + (i + 1));
  column.forEach(v => console.log(v));
});

console.log("Function F =", data.F);
console.log("Сomplexity L =", data.L);

As a result, you get function itself (F), its complexity (L) and templates for points (columns).

reduced-dnf's People

Contributors

thgleb avatar

Watchers

James Cloos avatar  avatar

reduced-dnf's Issues

Issue in handling logical tautologies and fallacies

Hi!

The code doesn't handle cases where the variables have all possible combinations as true or false to give out a proper dnf (1 or 0).
for instance,
let data = dnf(["x_1","x_2","x_3","x_4"], [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]); {for tautologies}and
let data = dnf(["x_1","x_2","x_3","x_4"], []); {for fallacies} gives no DNF in return.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.