Message Boards Message Boards

Angle variable "escaped" from DynamicModule?

Posted 4 years ago

Finally getting the hang of Dynamic and DynamicModule, I think. But I'm puzzled why the local variable for the angle, theta, gets updated when I move a slider which is inside a DynamicModule. I'm trying to see how we can "grow our own" interfaces from the ground up in order to have a little more flexibility that Manipulator panes, etc. might give.

enter image description here

Attachments:
11 Replies

I'm not sure what I might have formatted wrong here. I have a couple lines above the main routine, which I'll take out to avoid confusion.

Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST

The rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.

int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]

You can also embed notebook or attach notebook.

enter image description here

POSTED BY: Moderation Team

Finally got the WYSIWYG kind of plotting I wanted, using "roll-your-own" packaging of controls instead of a Manipulator pane. Just want to see how things can be done with the most flexibility, e.g. switching to shared globals and using separate windows simultaneously when one doesn't have too much screen space.

I just wish that ParametricPlot would automatically accept column- or row-vectors, instead of having to use the less-readable and less-intuitive list-format, or a kludgy-looking conversion rule. I have to use the rule right on the column-vector, instead of at the end of the call to ParametricPlot the way I'd like to.

At any rate, I'm really glad that with just a little tweaking, I can use traditional matrices and vectors without any problems. The user can just directly enter in any combination of transformations, adding more sliders if needed, and immediately see the result.

One other important thing: You have to put an initial value in for the angle value somewhere in your code. Am I missing something, or is there a way to do that in the Slider[ ] call itself?

enter image description here

Attachments:
Posted 4 years ago

For the initial value, maybe something like this:

DynamicModule[{plotLimit = 0.5},
  Column[{
    Dynamic@Plot[Sin[x], {x, 0, plotLimit}, PlotRange -> {{0, 2 \[Pi]}, {-1.1, 1.1}}],
    Slider[Dynamic@plotLimit, {0.1, 2 \[Pi]}]
  }]
]
POSTED BY: Hans Milton

Thanks very much, that does just what I want, initializing the value if the file is being use for the first time (since last modification, I guess) but saves the last value set via the slider from the last session.

Is there any way to delete a post when you've made an extra copy by mistake? I guess it can just have it's content removed via editing, but I don't see any way to delete the whole post.

I manage to streamline things a little bit by just putting all my vertices into matrices, one for a unit square aligned to the axes, and the other for whatever transformations we want to apply.

Just want to have something where everything is "WYSIWYG" ("what-you-see-is-what-you-get") for purposes of connecting the diagrams and the matrix algebra better.

The only drawback is that I have to remember to take the transposes if I want to be able index the points directly.

enter image description here

Attachments:

You have typed \[CurlyTheta]\[Degree] without any space in between, which makes it into a new variable, unrelated with \[CurlyTheta].

POSTED BY: Gianluca Gorni

I've got to say that IMHO there ought to be a way to have the degree sign right next to the angle variable without a space the way it is in every math, physics, engineering, etc. book. Any opinions? Is there a way to type a small space or other nearly invisible separator?

I've got to say that IMHO there ought to be a way to have the degree sign right next to the angle variable without a space ...

FYI: ° is not a "degree sign", it is a - quite intuitive - constant:

enter image description here

therefore there must be a white space character between this and some symbol to denote "multiplication". If you do not like this you can write it as a quantity:

enter image description here

POSTED BY: Henrik Schachner

Thanks. I'm still trying to understand if this Quantity[ ] function is giving an actual number, or what. But it looks useful for physics problems and that kind of thing.

Meanwhile, I guess I'll just use a narrow space (via Esc-space-space-Esc) between an angle and a degree mark.

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