Message Boards Message Boards

6 Replies
0 Total Likes
View groups...
Share this post:

blue variables

Posted 10 years ago

I'm having a really hard time taking my code from the desktop to mathematica online. Basically, nothing seems to work beyond 2+2. As a start can anybody tell me why my variables which are perfectly defined in the desktop version all appear as blue in Mathematica Online? Is there a way to force the interpreter to re-evaluate all the variables.

Attached is a notebook that runs fine in the desktop that wont run at all in Mathematica Online.

Also, it is incredibly slow - is anybody actually using Mathematica Online to get any work done?

POSTED BY: Mark Lawton
6 Replies

Ok, confirmes, Buttons in a Manipulate on teh Wolfram Cloud do not work.

This works fine in a desktop notebook:

Manipulate[Column[{Button["print", x = Random[]], x a}], {a, 1, 2}]

But on the Cloud the button is inactive.

I will file it as a bug....

POSTED BY: David Reiss

Frankly I am not sure.

I use your notebook (but add definitions for myBlue and myBackgroundColor at the top) and the code generates syntax errors when executed on the Cloud. The syntax errors go away if I add a space (anywhere) in the affected portions of code. Clearly there is some issue with the Cloud Syntax checking.

The notebook then runs and the Manipulate is generated and works except that the button does not work in the cloud case. I think that, in the case of the Button, desktop Mathematica is being forgiving. Your code might be a bit more resistant in this aspect to use something like:

    Button["New Start Positions", a = 5; 
     doRotation[a, step, True, randomize]],
    doRotation[a, step, False, randomize]}
  {{a, 5, "n steps"}, 1, 50, 1},
  {{step, 10, "step size"}, 10, 33},
  {{randomize, False, "randomize"}, {False, True}},
  SaveDefinitions -> True, TrackedSymbols -> All
 Background -> myBackgroundColor]

But aside from that (which I have not yet tested on the cloud) I think you're uncovering bugs. Wolfram Cloud is designated "Beta" at this point. I suspect there's some number of bugs in it that need to be ferreted out before it's ready for prime time.

POSTED BY: David Reiss
Posted 10 years ago

Thanks again. Your solution seems to work but I can't say I really understand... even if the graphic generated by Manipulate isn't there, there seems to be a problem. To be specific, I copy the code into a new notebook. I don't hit shift enter. I upload the new notebook into Mathematica Online. When I hit shift enter, I get errors. Then I change SaveDefinitions to False. Then I hit shift enter and it works fine. I would think that the definitions are saved with the graphic itself not with the code. So, I don't see what is really happening. But your solution does seem to work.

Any more thoughts that could bring this to light would be very helpful. Thanks again.

POSTED BY: Mark Lawton
Posted 10 years ago

very helpful. I would not have thought of this nor discovered it. thank you very much.

POSTED BY: Mark Lawton

What likely is happening is this. When you wrote the code you had defined myBlue and myBackgroundColor at some point. Your Manipulate has SaveDefinitions->True and therefore the values of myBlue and myBackgroundColor are saved inside of the Manipulate. When the notebook opens in a fresh copy of Mathematica and the Manipulate appears on the screen the values of myBlue and myBackgroundColor (as well as any other saved definitions in the Manipulate) are set inside of the Manipulate and thereby in the Global' context. So because of this you didn't see that myBlue and myBackgroundColor are actually not set in the notebook.

A good rule of thumb when working coding up Manipulates with SaveDefinitions->True is to comment out the SaveDefinitions->True while working with it so you can see via syntax hilighting whether you are missing something that should be defined elsewhere in the notebook.

I hope this helps....

POSTED BY: David Reiss

The code in the notebook that you posted does not work in Desktop Mathematica.

myBlue and myBackgroundColor are not defined

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract