Forum archive 2000-2006

David Vos - Simplifying terms

David Vos - Simplifying terms

by Arnold Pizer -
Number of replies: 0
inactiveTopicSimplifying terms topic started 4/10/2002; 1:28:23 PM
last post 4/10/2002; 11:11:29 PM
userDavid Vos - Simplifying terms  blueArrow
4/10/2002; 1:28:23 PM (reads: 967, responses: 1)
I am displaying an equation "Ax^2 + Bx + C" where A, B, and C are random integers.

To beautify the output, it would be nice to handle cases where A,B, and C are 0 or 1. I.e. if C == 0, only show "Ax^2 + Bx". Or, if A ==1, only show "x^2 + Bx + C". I can handle that myself, but it would be nice to have a function like FEQ() do that for me.

Is there an easy way to do this?

David

<| Post or View Comments |>


userMark Schmitt - Re: Simplifying terms  blueArrow
4/10/2002; 11:11:29 PM (reads: 1189, responses: 0)
David,

In PGpolynomial macros, which is in the CVS, I put a way to convert an array of coefficients into a properly formatted polynomial expression.

To get $A x^2 + $Bx + $C, you would do something like @array=($A,$B,$C); $poly = polyString(~~@array);

In the text of the problem, you would then just type $poly where you wanted your polynomial.

It's not quite as automatic as FEQ, but I think it works. Maybe at some point I will try to code something to work inside the text block, like a \{polynomial($A,$B,$C)\}.

 

Mark

<| Post or View Comments |>