10-10-2018 04:58 PM
@Mark_Yedinak
LabVIEW, more precisely G, is a programming language. It is not intended to be the be-all-end-all mathematics tool. I not familiar with the R tool that you mention but I suspect that is a very focused tool for solving mathematics problems, not a general purpose programming language. Most programming languages would not have that as a builtin function.
I think LabVIEW is an excellent tool for the computer-machine interactions. Altenbach has convinced me that is it also great for fitting spectroscopic lines. However, I do not consider/think it is a general purpose programming language, as it was not originally built for that function. But it is extremely useful for a lot of use cases.
mcduff
10-10-2018 05:04 PM
When I used to program in Pascal, I once wanted to compute a rather insane N Choose R (maybe the number of Bridge hands?), and quickly saw that I didn't want to use Factorials (though if you are clever and factor things, you can reduce the problem to "cancel factors, multiply, and add"). I used the Formula on which Pascal's Triangle is based -- N Choose R = (N-1) Choose (R-1) + (N-1) Choose R. No multiplication at all, only simple addition. Oh, and recursion (I love using recursion).
Many years later, "just for fun", I coded this in LabVIEW. Here are some results, with timings:
215 Choose 2 = 23005, and takes 0.019 s to compute (yes, 19 ms).
215 Choose 3 = 1633355, and takes 1.08 s.
215 Choose 4 = 86567815, and takes 53.7 s.
Do I dare try 215 Choose 5? Maybe while having dinner ...
Bob Schor
10-10-2018 05:26 PM
Cannot edit my previous post, but am now getting the same answers, my one-line solution was giving all possible subsets up to length 2 or 4, instead of only length 2 or 4, so now my answers are
Length[Subsets[Range[215], {4}]]
86567815
Length[Subsets[Range[215], {2}]]
23005
And for @Bob_Schor
AbsoluteTiming[Length[Subsets[Range[215], {4}]] ]
{15.074, 86567815}
AbsoluteTiming[ Length[Subsets[Range[215], {2}]] ]
{0.0028553, 23005}
Somewhat surprised that an interpreted language is faster, I guess the function is highly optimized.
I'm guessing that CA will submit some code before the night is over, the size of a postage stamp that puts these benchmarks to shame.
mcduff
PS Started to run Choose 5, still running and using 120GB of my computer's memory and starting to freeze my system.
10-10-2018 07:01 PM
Well, LabVIEW says 215 Choose 5 = 3653161793, and it took 2258 s (37 minutes, 38 s) on my three-year-old laptop and LabVIEW 2016.
Just for fun, I asked Mathematica what Binomial[215, 5] was.
AbsoluteTiming[Binomial[215, 5]]
{5.92593*10^-6, 3653161793}
That's 6 microseconds!! And LabVIEW's value for the Coefficient is the same. But then Mathematica was designed to do Math, and do it quickly, whereas LabVIEW is an Engineering Workbench and does what it does better than most other systems I know about.
Bob Schor
10-10-2018 07:26 PM
Tl,dr
Yes I scanned the thread but it really boils down to that last itty bitty bit of an IEEE 754 represention of a real number.
I really didn't enjoy 7th grade..I was somewhat of a nerd and sang descant... not exactly happy times but, I remember set theory. There is a set of whole numbers, there is a set of real numbers, there is a set of real numbers that can be exacty discribed with yeah so many bits interpreted in such a way...sign, mantisa, exponent
Could you clarify?
10-10-2018 07:31 PM
@mcduff wrote:
@Mark_Yedinak
LabVIEW, more precisely G, is a programming language. It is not intended to be the be-all-end-all mathematics tool. I not familiar with the R tool that you mention but I suspect that is a very focused tool for solving mathematics problems, not a general purpose programming language. Most programming languages would not have that as a builtin function.I think LabVIEW is an excellent tool for the computer-machine interactions. Altenbach has convinced me that is it also great for fitting spectroscopic lines. However, I do not consider/think it is a general purpose programming language, as it was not originally built for that function. But it is extremely useful for a lot of use cases.
mcduff
I guess I need to change my job then since I have been using LabVIEW for the past 20+ years as a general purpose programming language. I have written some very large applications in LabVIEW that don't interact with a single piece of hardware, at least not the type most people think of when talking about LabVIEW. A current application tests printer firmware. Yes, one could argue that communicating with a printer is communicating with HW it is simply using the printer's language to communicate over TCP or USB.
The application below is written 100% in LabVIEW.