2 deleted 8 characters in body; edited title

# why Why does a variable become real when using the second argument of Dynamic?

Version 9, on windowsWindows 7.

Please compare these 2 very simple examples

Manipulate[
x,
Row[{Manipulator[Dynamic[x], {0, 10, 1/100}]}],
{{x, 1}, None}
]


and

Manipulate[
x,
Row[{Manipulator[Dynamic[x, (x = #) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


Would you not expect them to work the same way?

But in the second case, x becomes real, while in the first case it remains rational as expected.

Any one knows the reasoning for this? I read about the second argument of dynamicsDynamic, but do not see something obvious. I did not read everything about it. But the above behaviour is surprising.

The fix is easy:

Manipulate[
x,
Row[{Manipulator[
Dynamic[x, (x = Rationalize[#]) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


thanks

# why does a variable become real when using the second argument of Dynamic?

Version 9, on windows 7

Please compare these 2 very simple examples

Manipulate[
x,
Row[{Manipulator[Dynamic[x], {0, 10, 1/100}]}],
{{x, 1}, None}
]


and

Manipulate[
x,
Row[{Manipulator[Dynamic[x, (x = #) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


Would you not expect them to work the same way?

But in the second case, x becomes real, while in the first case it remains rational as expected.

Any one knows the reasoning for this? I read about the second argument of dynamics, but do not see something obvious. I did not read everything about it. But the above behaviour is surprising.

The fix is easy:

Manipulate[
x,
Row[{Manipulator[
Dynamic[x, (x = Rationalize[#]) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


thanks

# Why does a variable become real when using the second argument of Dynamic?

Version 9, on Windows 7.

Please compare these 2 very simple examples

Manipulate[
x,
Row[{Manipulator[Dynamic[x], {0, 10, 1/100}]}],
{{x, 1}, None}
]


and

Manipulate[
x,
Row[{Manipulator[Dynamic[x, (x = #) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


Would you not expect them to work the same way?

But in the second case, x becomes real, while in the first case it remains rational as expected.

Any one knows the reasoning for this? I read about the second argument of Dynamic, but do not see something obvious. I did not read everything about it. But the above behaviour is surprising.

The fix is easy:

Manipulate[
x,
Row[{Manipulator[
Dynamic[x, (x = Rationalize[#]) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


1

# why does a variable become real when using the second argument of Dynamic?

Version 9, on windows 7

Please compare these 2 very simple examples

Manipulate[
x,
Row[{Manipulator[Dynamic[x], {0, 10, 1/100}]}],
{{x, 1}, None}
]


and

Manipulate[
x,
Row[{Manipulator[Dynamic[x, (x = #) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]


Would you not expect them to work the same way?

But in the second case, x becomes real, while in the first case it remains rational as expected.

Any one knows the reasoning for this? I read about the second argument of dynamics, but do not see something obvious. I did not read everything about it. But the above behaviour is surprising.

The fix is easy:

Manipulate[
x,
Row[{Manipulator[
Dynamic[x, (x = Rationalize[#]) &], {0, 10, 1/100}]}],
{{x, 1}, None}
]