Group Abstract Group Abstract

Message Boards Message Boards

1
|
7.2K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How do I hold arguments for simplification

Posted 12 years ago

Hi,

I am trying to create a simple "Manipulate" that takes in 2 fractions and then adds them. When I input the fractions I don't want them to simplify until they are added together. In other words, I just want the answer in simplified form. But the moment I input them and press enter... the fractions themselves reduce to simplified form. Is there a way to stop this from happening?

Manipulate[Row[{a, "+", b, "=", Simplify[a + b]}],
 Row[{Control[{{a, 1/2, ""}}], Control[{{b, 1/2, ""}}]}]]
POSTED BY: Michael McCain
2 Replies
Posted 12 years ago

You can prevent this by working with boxes for example:

DynamicModule[{a = 1, b = 2},
 Column[{
   Dynamic @ DisplayForm @  RowBox[{a, "+", b, "=",  Plus @@ (ToExpression /@ {a, b}) // Simplify}],

   Row[{
     InputField[Dynamic[a], Boxes],
     InputField[Dynamic[b], Boxes]}]

   }]
 ]

enter image description here

POSTED BY: Kuba Podkalicki
POSTED BY: Michael McCain
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard