LabVIEW Idea Exchange

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

Make polynomial evaluation less confusing

Status: New

Very long ago, I remember hooking up polynomial evaluation with the inputs reversed, because the labeling of the connectors and the icon image are just all over the place and very confusing. (In recent years I always hesitate for a few second to remind me that I need to hook it up opposite than what would feel natural.) :D:

 

Let's look at the help page of the version that accepts an array for x:


 


  

  • We have a connector "A" which is actually an array of X values.  (Makes no sense!)
  • We have an input P(x), which is the array of polynomial coefficients [a] and has nothing to do with x. (Makes no sense!)
  • We have a generic polynomial header graphics on top that says: ∑aix^i (good, that makes sense!)
  • We have a graphic that says P(x)|x=a (what does that even mean!???)
  • We have an output that says P(A) (why?)

 

It couldn't  be made any more confusing: a's and x's everywhere and no rhyme nor reason to tie it all logically together!

 

 

Suggestion:

  • Upper left input should be called x, or [x]
  • Lower left input should be called [a]
  • Upper right output should be called P(x)
  • The icon should be changed to a more resonable formula that actually makes sense.

 

12 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

A stands for array: makes perfect sense.

P(x): stands for polynomial in x (as in P(x) = a_0 + a_1.x +...), makes perfect sense.

x = a because A is an array of a's (A = [a]), makes perfect sense.

P(A) stands for array of P(a) [P(a)], makes perfect sense.

The only thing that could be improved to limit the risk of confusion of novices would be to avoid using the symbol a for the polynomial coefficients. They could fix that by having the expected form of the polynom in the Help (I think I remember it used to be there in the past, but seems to have disappeared from this version of the VIs)

But, hey, that's just my opinion, man... I personally don't even look at this anymore and plug the data array at the top and the coefficients at the bottom and voila!

 

The only thing that does not make sense in this VI is the error output, which is limited to an error code (see this). I am surprised that this does not bother you.

 

PS: Take a look at the brilliant "error code mapping for polynomial.vi" subVI (warning: the P in PS does not stand for polynomial).

altenbach
Knight of NI

It's just not consistent. For example the output of the polynomial fit is called "Polynomial Coefficients" and not P(x). Why call the same thing with different names in different functions? (see also this example for a typical use)

 

Also compare to linear evaluation, where the upper input is actually called "X" (as I expect for both functions, since linear evaluation is just a special case of polynomial evaluation with only two coefficients). X is the independent variable.

 

"A" stands for array??? You are being funny! 😄 Not a single function in the array pallete has an "A" input or output. 😮

 

In nonlinear fitting, the parameter array is called "a" in the model template. This is similar to the coefficients of a polynomial fit.

 

 

altenbach
Knight of NI
X.
Trusted Enthusiast
Trusted Enthusiast

A also stands for Arbitrary. And X is already taken (by me) anyhow.

altenbach
Knight of NI

> And X is already taken (by me) anyhow.

 

I think I can probably find some prior art on that. 😄

X.
Trusted Enthusiast
Trusted Enthusiast

BTW, I'll not that in the Linear Evaluation example that you are bringing up as devoid of confusion, the icon indicates a Sum of a_i X^i which I have a hard time to understand what it relates to (a is a scalar in all the variants). I can however think of why it is so: the icon has been recycled from... the polynomial evaluation VIs.

altenbach
Knight of NI

Yes, that's common to everything in the polynomial palette. I am OK with it. Nice and clear.

 

(Similarly, the linear fit has a wavy line common to all fitting VIs. All signal generation VIs have a sine function in the icon header. :D)

 

(As I said, it reserves the letter "a", so that letter should not be used for unrelated inputs).

WG-
Member
Member

I don't think it confusing. Everything is very clear as X. says. And for your understanidng P(x)|x=a is a notation of telling that the function P(x) is evaluated at the point x = a, it was introduced by the mathematican Gottfried Leibniz.

-edit- the only comment I have is that the inputs A and P(x) maybe should be switched. 

 

Darin.K
Trusted Enthusiast
I would be curious about the source for Leibniz introducing the bar notation, that conflicts with what I recall. He certainly gave us the df/dx notation, but the bar is independent of that as far as I can recall. Clearly the notation P(x)|x=a is not precisely correct as it should either be P(x=a),P(a), P|x=a or simply P|a. The evaluation bar, regardless of inventor, is meant as a shorthand for the () notation. My own beef with this function is the (ab)use of A by using it both for the coefficients of the polynomial and the evaluation points. I'd prefer x (scalar) or X (array) for the points, P for the polynomial, and P(x) or P(X) for the output.
WG-
Member
Member

Leibniz used this notation first when evaluating differenatial equations at a certain point df/dx|x=a. 

http://www.maths.manchester.ac.uk/~cds/articles/derivative.pdf and many more, just google

And you are correct it is shorthand for the () notation. However in literature you will see that both notations are often mixed up with each other becoming P(x)|x=a is seen often in the literature, seen it tells us that P is a function of x and is evaluated at x=a. What if P is a function of x and y? P|x=a a reader might then still think its a function of only x, for example. Further its not a wrong notation, it is correct. It's just a notation, it is not a rule, notations change when time passes, and we can change them as we see fit, as long as you explain what its meant.