Message Boards Message Boards

0
|
5395 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Cosine in number form

Posted 9 years ago

Hi, I have the next problem: In the following code, I want the cosine´s value numerically but all I get is the code´s copy I have written, not a number.

cos = Plot[Cos[x], {x, 0, 2 Pi}];
    With[{x = Dynamic[MousePosition["Graphics", {0, 0}][[1]]]}, 
     Show[cos, Graphics[Locator[{x, Cos[x]}]]]]

enter image description here

Is there any way to obtain the cosine´s value in number form? I think the problem is Mathematica interprets the x coordinate like a position´s coordinate, not like a number.

POSTED BY: Luciano Tresto
2 Replies

You have to wrap Dynamic around what you want to update:

Dynamic[Cos[MousePosition["Graphics", {0, 0}][[1]]]]
POSTED BY: Sean Clarke
Posted 9 years ago

It was a silly mistake for my part. Thank you very much for the aclaration!

POSTED BY: Luciano Tresto
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