Coder Social home page Coder Social logo

butt4cak3 / solvethis-js Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 763 KB

Parse and execute mathematical expression

Home Page: https://www.npmjs.com/package/solvethis

License: MIT License

JavaScript 0.57% TypeScript 99.43%
equation expression formula math parser solver

solvethis-js's People

Contributors

butt4cak3 avatar dependabot[bot] avatar

Watchers

 avatar  avatar

solvethis-js's Issues

generating formula for RX and Tx exchange between two different equipment not speaking same language

Dear @Butt4cak3

I hope you are well and my best wishes for 2020,

I have an issue too #josdejong/mathjs#1699

And maybe you could help me with your library.

Topic - translate from different protocols data by generating mathematic formula.

One of the properties is "Formulas" of our datamodel is

Formulas ( Rx / Tx)

• Formulas provide a way to project values received from an equipment to another value range or representation.
• For example, an equipment might send gain values as INTEGERs ranging from 0 to 65535, while the actual gain range in is -64db to 12db. Obviously, the user of a front-end application prefers to deal with the gain values in db instead of the technical INTEGER range.
• To accommodate for this need, I am looking to provides the concept of formulas.

• This will create a basic formula which does not alter the input value – meaning it returns the identity of the input value:

image

Picture from ww.lawo.de

• The input value of the formula is denoted with the symbol $. You can use this symbol in an arithmetic expression which yields the desired output range.
• The line “$ =“ defines the input value (as sent by the device) of the formula.
• The following line “RX($) =“ defines the expression used to convert values that have been received from the device.
• The following line “TX($) =” defines the expression used to convert values that are about to get sent to the device. This expression has to reverse the projection made in the RX expression.

• To follow the ifSpeed example, let’s display the speed of the interface in megabytes per second instead of bits per second:
o Enter a test input value in the “$ =” field, e.g. “10000000” (10 megabit)
o Enter the expression $ / 8000000.0 into the “RX” field. 8000000 is the factor used to turn unit bits into unit megabyte.
o To reverse the RX expression, enter the expression $ * 8000000.0 into the “TX” field.
o You will now see the following:

image

Picture from www.lawo.de

o You can see that the result of the RX expression is 1.25 (megabytes) and the result of the TX expression, which uses 1.25 as input value, is 10000000 (bits per second, which is equal to the input value of the RX expression).

INPUT RANGE

• I have an Analog to Digital convert 12 bits (4096 positions)
• The manufacturer of the A/D converter infor you for 0 = -128dB and for 4095 = +15 dB

I am looking to create as above "Formula" with possibility to select linear or log the Rx and Tx formula.

Data model of my paramater

{
                    "identifier": "ParameTypeStream",
                    "description": "Stream PPM MAIN",
                    "value": 0,
                    "minimum": -4096,
                    "maximum": 480,
                    "access": "read",
                    "format": "%8.2f°",
                    "enumeration": "",
                    "factor": 32,
                    "isOnline": true,
                    "default": -1024,
                    "type": "integer",
                     "formula": "1000*\n1000/"
                }

The properties : formula

The Minimum & Maximum are :

"minimum": -4096,
"maximum": 480,

Then I need to generate the correct formula for Rx & Tx.

Regarding formula "1000\n1000/"*

That means when the client receives this properties the "/n" is the separation from RX formula then TX formula then no needs two properties

Here :

RX = value *1000
TX = value /1000

Use case - write the formula - RX

  1. the client introduces the formula in an editbox. Just the '$' indicates the value I need to passing into the math expression and get the result.

Use case - write the formula - TX

If the RX formula is already written in the editbox , I need and expect with Mathjs library to generate the invert formula for TX and vice-versa if Tx is filled, then I got RX.

If RX = $/1000
then I need to get for TX = $*1000

The formula could be complex (log, square, ^, (expression)*log) I attached a document from my friend written for F# (Microsoft) long time ago and now we are using nodejs and javascript.

Ember+ Formulas.pdf

I hope you could make a simple example of code how to use it and then I will try it ;-)

Best Wishes for 2020
Youssef

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.