LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Sleepy_Engineer

Quick Drop Simple Math

Status: New

I use the following shortcuts in Quick Drop:

"+" - shortcut for "add"

"-" - shortcut for "subtract"

"*" - shortcut for "multiply"

"/" - shortcut for "divide"

 

And that got me thinking that what I would really like is to be able to type simple math equations and have Quick Drop generate said equations.

So if we typed "(*3+2)/(4+5.68)", Quick Drop would spit out the following:

simple math.png

 

-Carl Wecker

14 Comments
Jeffrey_Zola
Member

I like any idea that simplifies entry. Does anyone have any benchmark data comparing the math primitives, formula nodes, the GPMath toolkit, or whatever other options may be out there?

 

Jeff

Jeffrey Zola
SteenSchmidt
Trusted Enthusiast

Yes, I have some benchmarking (I'd be the only one able to benchmark GPMath at the moment anyway).

 

Performance will always favor the statically defined (Formula Node, Primitives), as the strength of the built-in Formula Parsing and GPMath is expressions defined at runtime. Can you define the expression at edit-time, then use a formula node. Some numbers (laptop, 3rd gen Quad-core i7 w/ 20 gigs of RAM, performance numbers are in evaluations/s, higher is better):

 

SIN(X)^2+COS(X)/2

Formula node: 5.3 M

Primitives: 7.5 M

Formula Parsing: 0.6 M

GPMath: 1.5 M

 

(3*X+2)/(4+5.68)

Formula node: 11 M

Primitives: 9 M

Formula Parsing: 0.7 M

GPMath: 2.7 M

 

IFTE(A<0.5;2*A-X;B*X-8)

Formula node: 113 M

Primitives: 95 M

Formula Parsing: not possible

GPMath: 1.6 M

 

Note that the formula node is faster than using discrete primitives in some situations.

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
altenbach
Knight of NI

Don't forget the expression node. It comes very close to what you want in the examples with one single variable.

 

Basically:  Use QD to drop an expression node and then type the formula. It is also much more compact on the block diagram. Did you benchmark it?

Expressions.png

(... not sure if it would use constant folding in the upper example as it would with g code)

SteenSchmidt
Trusted Enthusiast

The Expression Node performs very much like the Formula Node.

 

GPMath is basically comparable to the built-in Formula Parsing VIs only, as they both support dynamic expression definitions which the other static LV functions do not. If I have a static formula expression I usually use a Formula Node, except in the cases where that doesn't support the function I want to evaluate.

 

/Steen

CLA, CTA, CLED & LabVIEW Champion