# Search the Community

Showing results for tags 'equation'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• Software & Hardware Discussions
• LabVIEW Community Edition
• LabVIEW General
• LabVIEW (By Category)
• Hardware
• Resources
• LabVIEW Getting Started
• GCentral
• Code Repository (Certified)
• LAVA Code on LabVIEW Tools Network
• Code In-Development
• OpenG
• Community
• LAVA Lounge
• LabVIEW Feedback for NI
• LabVIEW Ecosystem
• LAVA Site Related
• Site Feedback & Support
• Wiki Help

### Categories

• *Uncertified*
• LabVIEW Tools Network Certified
• LabVIEW API
• VI Scripting
• JKI Right-Click Framework Plugins
• Quick Drop Plugins
• XNodes
• General
• User Interface
• X-Controls
• LabVIEW IDE
• Custom Probes
• LabVIEW OOP
• Database & File IO
• Machine Vision & Imaging
• Remote Control, Monitoring and the Internet
• Hardware

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## Best practices for computing user equations

A few years ago I wrote my own equation computing algorithm for my company's flagship software. The user will write equations using variable names and constants (for example a=2*b+3), and those equations run continuously every 100ms. The pros The user can add Min and Max expressions inside the equation. For example a=Min(b,c)+2. The syntax supports parenthesis. For example a=3*(b+c). The limitations You can have several operators but their priority is not respected. For example the result of 1+2*3 will be 9 instead of 7. The user has to write 1+(2*3) or 2*3+1 to get the correct result. You can't put an expression inside a "Power" calculation. For example, you can do a+b^c but you can't do a^(b+c). You would need to create a new variable d=b+c and then do a+d, so now you have 2 equations running in parallel all the time instead of 1. There is no support (even though it wouldn't be hard to add) for sin, cos, tan, modulo, square root... I am now thinking of using a built-in LabVIEW feature (or one the community might have created ) in order not to reinvent the wheel completely. Surely I am not the only person who needs to compute equations. I looked at vi.lib\gmath\parser.llb\Eval Formula String.vi and it seems to answer 90% of my needs, it is simple to use, but it doesn't support Min and Max expressions and writing a hybrid system would be complicated. What do people use out there? If I need to reinvent the wheel, I found interesting resources such as https://en.wikipedia.org/wiki/Shunting-yard_algorithm and https://en.wikipedia.org/wiki/Operator-precedence_parser so I think I can pull it off, but it's going to be very time consuming! Cheers
×