what is POLYFORM?
12-01-2014, 10:25 PM (This post was last modified: 12-01-2014 11:28 PM by Alberto Candel.)
Post: #1
 Alberto Candel Member Posts: 169 Joined: Dec 2013
what is POLYFORM?
I have a program that outputs a list, like {2, 3, 6, 19} say. The numbers are the terms of a series, so I wanted to add them up. Instead of copying that into the SUMLIST command, I hit STO and them SUMLIST. My HP displayed POLYFORM({2,3,6,19},SUMLIST) and the result 30.

I cannot find anything about POLYFORM in the help menu. It does the above, but, what else? Anybody knows? Thanks
12-01-2014, 11:17 PM
Post: #2
 Han Senior Member Posts: 1,810 Joined: Dec 2013
RE: what is POLYFORM?
(12-01-2014 10:25 PM)Alberto Candel Wrote:  I have a program that outputs a list, like {2, 3, 6, 19} say. The numbers are the terms of a series, so I wanted to add them up. Instead of copying that into the SUMLIST command, I hit STO and them SUMLIST. My HP displayed POLYFORM({2,3,6,19},SUMLIST) and the result 30.

I cannot find anything about PLOYFORM in the help menu. It does the above, but, what else? Anybody knows? Thanks

What program did you use?

Graph 3D | QPI | SolveSys
12-01-2014, 11:30 PM
Post: #3
 Alberto Candel Member Posts: 169 Joined: Dec 2013
RE: what is POLYFORM?
It was a program that I wrote that outputs a list. Unfortunately it is gone: I did STO()and that wiped out everything!
12-01-2014, 11:34 PM
Post: #4
 Alberto Candel Member Posts: 169 Joined: Dec 2013
RE: what is POLYFORM?
But you may just type {1, 2, 3, 4} STO SUMLIST to see POLYFORM({1,2,3,4}, SUMLIST) on the left and the number 10 on the right. BTW, SUMLIST is $$\Sigma LIST$$
12-02-2014, 02:43 AM
Post: #5
 Han Senior Member Posts: 1,810 Joined: Dec 2013
RE: what is POLYFORM?
(12-01-2014 11:34 PM)Alberto Candel Wrote:  But you may just type {1, 2, 3, 4} STO SUMLIST to see POLYFORM({1,2,3,4}, SUMLIST) on the left and the number 10 on the right. BTW, SUMLIST is $$\Sigma LIST$$

I think you may have found a bug. I reproduced the behavior doing exactly what you suggested. To answer your question, here is what I was able to find:

POLYFORM(expression, var1, var2, …)

The idea is that the command will take an expression and expand it into the form of a polynomial, where the variable priority is given by var1, var2, etc.

In Home view:

POLYFORM((X+Y)^3, X, Y); --> Y^3 + 3*Y^2*X + 3*Y*X^2 + X^3 + 5
POLYFORM((X+Y)^3, Y, X); --> X^3 + 3*X^2*Y + 3*X*Y^2 + Y^3 + 5

You can also do some simple decompositions using POLYFORM(). If you use the syntax

POLYFORM(expression, 'operator')

where the operator is either + or *, then it will decompose the expression into either sums of simple (rational) terms or products of rational terms. For example

POLYFORM(1/(X^2-Y^2,'+'); --> 1/(2*Y)/(X+Y) - 1/(2*Y)/(X-Y)
POLYFORM(1/(X^2-Y^2,'*'); --> 1/((X-Y)*(X+Y))

(Basically, this alternate form somewhat resembles partial fraction decomposition when using '+' and rational factorization when using '*').

The alternate form of POLYFORM() also has a "shortcut":

expression STO STO will simply evaluate the expression and is equivalent to POLYFORM(expression, 'eval')
expression STO + is equivalent to POLYFORM(expression, '+')
expression STO * is equivalent to POLYFORM(expression, '*')

So what's the bug? It appears POLYFORM(expression,var1, var2,…) only behaves properly in Home mode and not in CAS (in CAS mode it does not sort the polynomial correctly according to the variable list). The second form POLYFORM(expression, 'operator') does not seem to be something one can type in whether in Home view or CAS view. However, the shortcut form seems to work in CAS view.

I suspect that it should not have worked for your case: {1,2,3} STO SUMLIST and yet it did anyway.

NOTE: Here, STO is really the arrow character produced by pressing the STO> menu option or using [Shift][EEX].

For those who can read French:

http://www-fourier.ujf-grenoble.fr/~pari...hprime.pdf
http://www-fourier.ujf-grenoble.fr/~pari...prime2.pdf

Graph 3D | QPI | SolveSys
12-02-2014, 07:13 AM
Post: #6
 parisse Senior Member Posts: 1,051 Joined: Dec 2013
RE: what is POLYFORM?
POLYFORM is not yet in the list of commands whose output is not autosimplified. Set autosimplify to none if you want to use it in CAS.
If the second argument to POLYFORM is a function, then convert is called, and if the function is not in the list of conversion functions, it is simply applied.
Code:
     if (v[1].type==_FUNC){       if (f==at_sincos)     return sincos(g,contextptr);       if (f==at_sin || f==at_SIN)     return trigsin(g,contextptr);       if (f==at_cos || f==at_COS)     return trigcos(g,contextptr);       if (f==at_tan || f==at_TAN)     return halftan(g,contextptr);       if (f==at_plus)     return partfrac(tcollect(g,contextptr),true,contextptr);       if (f==at_prod)     return _factor(_texpand(g,contextptr),contextptr);       if (f==at_division)     return _simplify(g,contextptr);       if (f==at_exp || f==at_ln || f==at_EXP)     return trig2exp(g,contextptr);       if (f==at_string){     int maxp=MAX_PRINTABLE_ZINT;     MAX_PRINTABLE_ZINT= 1000000;     gen res=string2gen(g.print(contextptr),false);     MAX_PRINTABLE_ZINT=maxp;     return res;       }       if (f==at_matrix || f==at_vector || f==at_array){     g.subtype=_MATRIX__VECT;     return g;       }       return f(g,contextptr);     }
12-03-2014, 02:40 AM
Post: #7
 Han Senior Member Posts: 1,810 Joined: Dec 2013
RE: what is POLYFORM?
Were you able to actually type in something like: POLYFORM((X+Y)^2,'*') into the calculator? I was not able to do so.

Graph 3D | QPI | SolveSys
12-03-2014, 06:51 AM
Post: #8
 Alberto Candel Member Posts: 169 Joined: Dec 2013
RE: what is POLYFORM?
(12-03-2014 02:40 AM)Han Wrote:  Were you able to actually type in something like: POLYFORM((X+Y)^2,'*') into the calculator? I was not able to do so.

I get nothing. In CAS it rewrites (x+y)^2. In Home, I cannot type it: the [,] key seems to be mismatched, as it displays a semicolon (which is [Alpha][+]). And if I pick the [comma] from the character table, I get an error.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)