(*^ ::[ frontEndVersion = "Microsoft Windows Mathematica Notebook Front End Version 2.2"; microsoftWindowsStandardFontEncoding; fontset = title, "Times New Roman", 24, L0, center, nohscroll, bold; fontset = subtitle, "Times New Roman", 18, L0, center, nohscroll, bold; fontset = subsubtitle, "Times New Roman", 14, L0, center, nohscroll, bold; fontset = section, "Times New Roman", 14, L0, bold, grayBox; fontset = subsection, "Times New Roman", 12, L0, bold, blackBox; fontset = subsubsection, "Times New Roman", 10, L0, bold, whiteBox; fontset = text, "Times New Roman", 12, L0; fontset = smalltext, "Times New Roman", 10, L0; fontset = input, "Courier New", 12, L0, nowordwrap, bold; fontset = output, "Courier New", 12, L0, nowordwrap; fontset = message, "Courier New", 10, L0, nowordwrap, R65535; fontset = print, "Courier New", 10, L0, nowordwrap; fontset = info, "Courier New", 10, L0, nowordwrap; fontset = postscript, "Courier New", 8, L0, nowordwrap; fontset = name, "Times New Roman", 10, L0, nohscroll, italic, B65535; fontset = header, "Times New Roman", 10, L0, right, nohscroll; fontset = footer, "Times New Roman", 10, L0, right, nohscroll; fontset = help, "Times New Roman", 10, L0, nohscroll; fontset = clipboard, "Times New Roman", 12, L0, nohscroll; fontset = completions, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = graphics, "Courier New", 10, L0, nowordwrap, nohscroll; fontset = special1, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = special2, "Times New Roman", 12, L0, center, nowordwrap, nohscroll; fontset = special3, "Times New Roman", 12, L0, right, nowordwrap, nohscroll; fontset = special4, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = special5, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = leftheader, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = leftfooter, "Times New Roman", 12, L0, nowordwrap, nohscroll; fontset = reserved1, "Courier New", 10, L0, nowordwrap, nohscroll;] :[font = title; inactive; nohscroll; center; ] How to Find the Sign of a Polynomial with FindSign.m Package :[font = subsubtitle; inactive; nohscroll; center; ] Yuji Itaya Department of Information Management School of Business Administration Asahi University Hozumi, Motosu, Gifu, Japan E-mail: itaya@alice.asahi-u.ac.jp :[font = text; inactive; ] This package finds the sign of a given polynomial, assuming that the domains of variables are real. :[font = section; inactive; ] Loading a package :[font = input; nowordwrap; ] Needs["findSign`"]; :[font = section; inactive; ] Finding the sign :[font = text; inactive; ] To find the sign, just use findSign function. The output is either positive, nonnegative, zero, nonpositive, negative, or indeterminate. :[font = input; startGroup; nowordwrap; ] findSign[-x^2-x-1] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "negative" ;[o] negative :[font = input; startGroup; nowordwrap; ] findSign[Expand[(x-y)^4+y^2+1]] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive :[font = input; startGroup; nowordwrap; ] findSign[x^2-x-1] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "indeterminate" ;[o] indeterminate :[font = text; inactive; ] We can easily verify by using Plot that x^2-x-1 has no definite sign: :[font = input; startGroup; nowordwrap; ] Plot[x^2-x-1,{x,-3,3}] :[font = postscript; inactive; output; BITMAP; PostScript; pictureLeft = 100; pictureTop = 0; pictureWidth = 300; pictureHeight = 185; nowordwrap; ] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.15873 0.0747767 0.0480493 [ [(-3)] .02381 .07478 0 2 Msboxa [(-2)] .18254 .07478 0 2 Msboxa [(-1)] .34127 .07478 0 2 Msboxa [(1)] .65873 .07478 0 2 Msboxa [(2)] .81746 .07478 0 2 Msboxa [(3)] .97619 .07478 0 2 Msboxa [(2)] .4875 .17088 1 0 Msboxa [(4)] .4875 .26697 1 0 Msboxa [(6)] .4875 .36307 1 0 Msboxa [(8)] .4875 .45917 1 0 Msboxa [(10)] .4875 .55527 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .07478 m .02381 .08103 L s P [(-3)] .02381 .07478 0 2 Mshowa p .002 w .18254 .07478 m .18254 .08103 L s P [(-2)] .18254 .07478 0 2 Mshowa p .002 w .34127 .07478 m .34127 .08103 L s P [(-1)] .34127 .07478 0 2 Mshowa p .002 w .65873 .07478 m .65873 .08103 L s P [(1)] .65873 .07478 0 2 Mshowa p .002 w .81746 .07478 m .81746 .08103 L s P [(2)] .81746 .07478 0 2 Mshowa p .002 w .97619 .07478 m .97619 .08103 L s P [(3)] .97619 .07478 0 2 Mshowa p .001 w .05556 .07478 m .05556 .07853 L s P p .001 w .0873 .07478 m .0873 .07853 L s P p .001 w .11905 .07478 m .11905 .07853 L s P p .001 w .15079 .07478 m .15079 .07853 L s P p .001 w .21429 .07478 m .21429 .07853 L s P p .001 w .24603 .07478 m .24603 .07853 L s P p .001 w .27778 .07478 m .27778 .07853 L s P p .001 w .30952 .07478 m .30952 .07853 L s P p .001 w .37302 .07478 m .37302 .07853 L s P p .001 w .40476 .07478 m .40476 .07853 L s P p .001 w .43651 .07478 m .43651 .07853 L s P p .001 w .46825 .07478 m .46825 .07853 L s P p .001 w .53175 .07478 m .53175 .07853 L s P p .001 w .56349 .07478 m .56349 .07853 L s P p .001 w .59524 .07478 m .59524 .07853 L s P p .001 w .62698 .07478 m .62698 .07853 L s P p .001 w .69048 .07478 m .69048 .07853 L s P p .001 w .72222 .07478 m .72222 .07853 L s P p .001 w .75397 .07478 m .75397 .07853 L s P p .001 w .78571 .07478 m .78571 .07853 L s P p .001 w .84921 .07478 m .84921 .07853 L s P p .001 w .88095 .07478 m .88095 .07853 L s P p .001 w .9127 .07478 m .9127 .07853 L s P p .001 w .94444 .07478 m .94444 .07853 L s P p .002 w 0 .07478 m 1 .07478 L s P p .002 w .5 .17088 m .50625 .17088 L s P [(2)] .4875 .17088 1 0 Mshowa p .002 w .5 .26697 m .50625 .26697 L s P [(4)] .4875 .26697 1 0 Mshowa p .002 w .5 .36307 m .50625 .36307 L s P [(6)] .4875 .36307 1 0 Mshowa p .002 w .5 .45917 m .50625 .45917 L s P [(8)] .4875 .45917 1 0 Mshowa p .002 w .5 .55527 m .50625 .55527 L s P [(10)] .4875 .55527 1 0 Mshowa p .001 w .5 .094 m .50375 .094 L s P p .001 w .5 .11322 m .50375 .11322 L s P p .001 w .5 .13244 m .50375 .13244 L s P p .001 w .5 .15166 m .50375 .15166 L s P p .001 w .5 .1901 m .50375 .1901 L s P p .001 w .5 .20931 m .50375 .20931 L s P p .001 w .5 .22853 m .50375 .22853 L s P p .001 w .5 .24775 m .50375 .24775 L s P p .001 w .5 .28619 m .50375 .28619 L s P p .001 w .5 .30541 m .50375 .30541 L s P p .001 w .5 .32463 m .50375 .32463 L s P p .001 w .5 .34385 m .50375 .34385 L s P p .001 w .5 .38229 m .50375 .38229 L s P p .001 w .5 .40151 m .50375 .40151 L s P p .001 w .5 .42073 m .50375 .42073 L s P p .001 w .5 .43995 m .50375 .43995 L s P p .001 w .5 .47839 m .50375 .47839 L s P p .001 w .5 .49761 m .50375 .49761 L s P p .001 w .5 .51683 m .50375 .51683 L s P p .001 w .5 .53605 m .50375 .53605 L s P p .001 w .5 .05556 m .50375 .05556 L s P p .001 w .5 .03634 m .50375 .03634 L s P p .001 w .5 .01712 m .50375 .01712 L s P p .001 w .5 .57449 m .50375 .57449 L s P p .001 w .5 .59371 m .50375 .59371 L s P p .001 w .5 .61293 m .50375 .61293 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p .004 w .02381 .60332 m .06349 .52224 L .10317 .44716 L .14286 .37809 L .18254 .31502 L .22222 .25796 L .2619 .20691 L .30159 .16187 L .34127 .12283 L .38095 .08979 L .42063 .06276 L .46032 .04174 L .48016 .03348 L .5 .02673 L .51984 .02147 L .52976 .01941 L .53968 .01772 L .5496 .0164 L .55456 .01589 L .55952 .01547 L .56448 .01514 L .56696 .01501 L .56944 .0149 L .57192 .01482 L .57316 .01479 L .5744 .01476 L .57564 .01474 L .57688 .01473 L .57813 .01472 L .57937 .01472 L .58061 .01472 L .58185 .01473 L .58309 .01474 L .58433 .01476 L .58681 .01482 L .58929 .0149 L .59177 .01501 L .59425 .01514 L .59921 .01547 L .60417 .01589 L .60913 .0164 L .61905 .01772 L .62897 .01941 L .63889 .02147 L .65873 .02673 L .67857 .03348 L .69841 .04174 L .7381 .06276 L .77778 .08979 L .81746 .12283 L Mistroke .85714 .16187 L .89683 .20691 L .93651 .25796 L .97619 .31502 L Mfstroke P P % End of Graphics MathPictureEnd :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] Graphics["<<>>"] ;[o] -Graphics- :[font = section; inactive; ] Logarithmic and exponential functions :[font = text; inactive; ] The package has rules of logarithmic and exponential functions. :[font = input; startGroup; nowordwrap; ] findSign[Expand[(x-y+1)^4+y^6+z^2+Exp[-x]]] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive :[font = input; startGroup; startGroup; nowordwrap; ] findSign[Log[1/(x^2+1)]] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "nonpositive" ;[o] nonpositive :[font = input; startGroup; nowordwrap; ] findSign[Log[1+1/(x^2+1)]] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive :[font = section; inactive; endGroup; ] Polynomial of some variables which signs are known :[font = text; inactive; ] The known signs of variables can be specified in options: Specify positive variables in positiveVariables; nonnegative variables in nonnegtiveVariables; zero variables ( which seems meaningless, but is introduced because of symmetry to nonzeroVariables ) in zeroVariables; nonpositive variables in nonpositiveVariables; negative variables in negativeVariables; nonzero variables in nonzeroVariables. :[font = input; startGroup; nowordwrap; ] findSign[x-y+z^2,positiveVariables->{x},negativeVariables->{y}] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive :[font = input; startGroup; nowordwrap; ] findSign[Log[1+1/(x+1)],nonnegativeVariables->{x}] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive :[font = section; inactive; ] Polynomial Structure :[font = text; inactive; ] Set the option structureDisplay as True when we want to know the polynomial structure. :[font = input; startGroup; nowordwrap; ] findSign[1+x,positiveVariables->{x},structureDisplay->True] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] {"positive", {Plus, {"positive", {1}}, {"positive", {x}}}} ;[o] {positive, {Plus, {positive, {1}}, {positive, {x}}}} :[font = text; inactive; ] The second part of the output means that the given polynomial is the sum (Plus) of {positive, {1}} and {positive, {x}}. {positive, {1}} and {positive, {x}} indicate that 1 is positive and that x is positive, respectively. :[font = input; startGroup; nowordwrap; ] findSign[Expand[(x-y)^4+y^2+1],structureDisplay->True] :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] {"positive", {Plus, {"positive", {1 + y^2}}, {"nonnegative", {Power, {"indeterminate", {-x + y}}, {"positive", {4}}}}}} ;[o] 2 {positive, {Plus, {positive, {1 + y }}, {nonnegative, {Power, {indeterminate, {-x + y}}, {positive, {4}}}}}} :[font = text; inactive; ] Note that the package finds the sign by changing the given polynomial to (1+y^2)+(-x+y)^4. :[font = section; inactive; ] Tracing the procedure :[font = text; inactive; ] Set the option tracing as On when we want to know the procedure of determining the sign. :[font = input; startGroup; nowordwrap; ] findSign[x-y+z^2,positiveVariables->{x},negativeVariables->{y},tracing->On] :[font = print; inactive; formatted; output; nowordwrap; ] 2 Evaluating the sign of x - y + z Evaluating the sign of 1 its sign->positive Evaluating the sign of -2 its sign->negative Evaluating the sign of -x + y Evaluating the sign of -x Evaluating the sign of x its sign->positive its sign->negative Evaluating the sign of y its sign->negative its sign->negative Evaluating the sign of 1 its sign->positive Evaluating the sign of 2 its sign->positive Evaluating the sign of -x + y Evaluating the sign of -x Evaluating the sign of x its sign->positive its sign->negative Evaluating the sign of y its sign->negative its sign->negative its sign->positive ;[o] 2 Evaluating the sign of x - y + z Evaluating the sign of 1 its sign->positive Evaluating the sign of -2 its sign->negative Evaluating the sign of -x + y Evaluating the sign of -x Evaluating the sign of x its sign->positive its sign->negative Evaluating the sign of y its sign->negative its sign->negative Evaluating the sign of 1 its sign->positive Evaluating the sign of 2 its sign->positive Evaluating the sign of -x + y Evaluating the sign of -x Evaluating the sign of x its sign->positive its sign->negative Evaluating the sign of y its sign->negative its sign->negative its sign->positive :[font = output; inactive; formatted; output; endGroup; nowordwrap; ] "positive" ;[o] positive ^*)