Message Boards Message Boards

0
|
7472 Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Call functions from a Manipulate?

I have a working graphic representation of a velocity profile between two velocities.

It uses Manipulate to adjust various parameters and this calls a few functions defined in the same scope.

When I publish this it fails to work. The output appears to show the text of every function call rather than their results.

See https://www.wolframcloud.com/env/gilesknap/Published/VelocityProfileExample.nb

What am I doing wrong?

Thanks, giles.

POSTED BY: Giles Knap
7 Replies

I don't see any issue with SaveDefinitions -> True. https://wolframcloud.com/obj/damanjits/Published/CloudPublishManipulate.nb

POSTED BY: Damanjit Singh

Thanks. Still no joy.

Here is my published workbook with the changes you suggest, still showing the issue. https://www.wolframcloud.com/obj/gilesknap/Published/work.nb

I feel that I'm misunderstanding something about the scoping of functions.

How scope is handled is the most unfamiliar aspect of wolfram language for a long term C++, Python programmer!

POSTED BY: Giles Knap

If you include the a=2 definition in the Initialization and set SaveDefinitions -> True, it should work, I think. Unfortunately I don't have time right now to give a better explanation than that, but I hope it works. You can always try to make the Manipulate in a notebook and see if it keeps working if you quit the kernel.

POSTED BY: Sjoerd Smit

SaveDefinitions -> True should do the trick, usually, but sometimes it's more reliable to use the Initialization option of Manipulate to make sure all necessary definitions are made before the Manipulate tries to run.

Example from the documentation:

Manipulate[f[x], {x, 0, 6}, 
    Initialization :> (
        f[z_] := Range[z]
    )
]
POSTED BY: Sjoerd Smit

More information. If I publish using CloudDepoly on the output cell then all is well. It is when I use the publish button to publish the whole workbook that I get the issue.

POSTED BY: Giles Knap

Thanks for the suggestion. I'm afraid this had no effect.

POSTED BY: Giles Knap
Posted 4 years ago

Hi Giles,

Try adding SaveDefinitions -> True as an option to Manipulate.

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

Group Abstract Group Abstract