questions about make boxes
- To: mathgroup at smc.vnet.net
- Subject: [mg13716] questions about make boxes
- From: Tom <toad at planet.eon.net>
- Date: Wed, 19 Aug 1998 01:38:09 -0400
- Sender: owner-wri-mathgroup at wolfram.com
I have been trying to figure out the examples that have been given recently responding to the question about box formatting. I can sort of understand the idea, but my knowledge doesn't allow me to modify the examples to fit my needs. I wonder if someone could help with this question. It seems that MakeBoxes would apply here, but I am not sure. Here is a very simple example of what I would like Mathematica to do .... Suppose we have coefficients, a,b ,c and d. They can take on integer values from -10 to 10. I would like to have the correct box form for the expression a x + b x + c x + d x. This means that if a = 1, and b = 0, and c = -1 and d = 12, the output would be something like... RowBox[{"x", "-", "x", "+", RowBox[{"12", "x"}]}] If I could see how this was done, then it could be applied to more complicated expressions. Basically I am after a way to correctly format a "string" of expressions of the kind "coefficient expression + coefficient expression + ......" so that I can pick the coefficients at random and have the output look the way it should. The expression might be a simple variable, or the root of something (eg. 2 root 18 + root 8 - 12 root 2 ) This is related to work I am doing for my math classes, using Mathematica to generate random math problems for my students. Thanks for your patience and any help you might offer. Sincerely, Tom De Vries