LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Square" function in formula node

The square(x) function in the formula node does not seem to work, can someone confirm, or give me some example syntax?

LabVIEW 6.1, Win2K
Certified LabVIEW Architect
0 Kudos
Message 1 of 9
(19,861 Views)
If you want calculate x^2 write y=power(2,x)
If you want square root write y=sqrt(x)
Message 2 of 9
(19,861 Views)
Hi Nadav,

the square function is not available in the base package. it's functionality is

square(x) Square Function square (x) returns: 1 if 2n <= x <= (2n + 1)
0 if 2n + 1 <= x <= (2n + 2)

where x is any real number and n is any integer.

If you have a look at the help for formula nodes, and then look at the functions from there, it includes square(x), but this doesn't work in a formula node!

You need to use the square function.vi sub vi under - Analyze->Mathematics->Numeric Functions

Anyone at NI comment? - Mis print in the help??
Win98 LV 6.1 PDS

S.
// it takes almost no time to rate an answer Smiley Wink
Message 3 of 9
(19,861 Views)
Hi Nadav, Sacha and Martin

1. The Square Function is not Avilable in Base Package.

2. The Square Function will not work in the Formula node. There are differences in using the Formula Node and Mathematics Parser. Please Look at attached file in .rtf format. This is Just a Copy of LV6.1 Help

3. To Implement A Square(x) function Use "Eval Formula Node.vi" or Square(x) function as defined above.

Please find Attached two implementations of Square(x) and differences as promised.

Good Luck!!

Mache
Good Luck!

Mache
0 Kudos
Message 4 of 9
(19,861 Views)
Hi,

x^2 is written as x**2. But x*x also works 😉

Regards,

Wiebe.

"martins bit" wrote in message
news:50650000000800000020540000-1027480788000@exchange.ni.com...
> The square(x) function in the formula node does not seem to work, can
> someone confirm, or give me some example syntax?
>
> LabVIEW 6.1, Win2K
Message 5 of 9
(19,861 Views)
Hi Mache,
so if you go to the LV Help on Formula Nodes, and then go to the "creating formula nodes" link, and then go to the "functions" link it says
square(x) is valid for a formula node -
mis-print???????????

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 6 of 9
(19,861 Views)
In Labview Help on How to...

Under Index Tab
type "Formula Node"
Under Formula Node look for "Parser Differences"
Thats where the table is... on what and how you can use Formula Node.

Th Problem as you mentioned is if you go to "Create..." link It gives you all the Functions that can be used by Formula and Expression Nodes. What is Missing is an extra column detailing the functions which are excetions for each case. All these caveats and tricks are listed under Mathematics VI's and none under Formula Node. Definitely something which can be easily corrected

To NI's Credit they give an email address so that you can comment on documentation.

Regards,

Mache
Good Luck!

Mache
0 Kudos
Message 7 of 9
(19,861 Views)
Hi Mache,
the mist clears......

One for the documentation guys as you said.
so the ones that won't work are
gamma, ci, si, spike, step, square

Thanks
S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 8 of 9
(19,861 Views)
Actually x*x is even preferable to x**2 for two reasons:

1) It's faster. x**2 computes the log(x) using a polynomial series,
multiplies the log by 2 and then exponentiates this value using
another polynomial series.

2) It's more accurate: Polynomial series have errors depending on the
number of terms that are used that are much higher than what you get
by a single multiply.

Of course with math coprocessors or built in MPU's in today's CPU's a
lot of this is implemented in hardware on the chip so speed is a lot
less of a factor than it used to be in the good old days but the
relative accuracy of x*x vs. x**2 should still be true.


Doug De Clue
LabVIEW programmer
ddeclue@bellsouth.net


"Wiebe@AIR" wrote in message news:1@news1.xs4all.nl>...
> Hi,
>
> x^2 is written as x**2. But x*x also works 😉
>
> Regards,
>
> Wiebe.
>
> "martins bit" wrote in message
> news:50650000000800000020540000-1027480788000@exchange.ni.com...
> > The square(x) function in the formula node does not seem to work, can
> > someone confirm, or give me some example syntax?
> >
> > LabVIEW 6.1, Win2K
Message 9 of 9
(19,861 Views)