Message Boards Message Boards

0
|
5781 Views
|
9 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Regarding units of output value

Posted 4 years ago

Hi All, I am using the following command, to find maximum of a function:

FindMaximum[Cos[phi Degree] (1 - 0.4 Sin[5 Degree + phi Degree]^2), phi]

And getting the following Out put:

{0.998309, {phi -> -2.22083}}

I know Mathematica by default use the values of an angle in Radians, therefore, I used the Degree with angles in INPUT.

Now, I am not sure about the value of output given in Mathematica. Whether its' phi=-2.22083 Degree OR -2.22083 Radians?

POSTED BY: abhishek sharma
9 Replies

Regarding units of output value

POSTED BY: Ian Williams

Yes, you're quite right. My mistake.

POSTED BY: Ian Williams

Yes, you're quite right. My mistake.

POSTED BY: Ian Williams

The result is in terms of degrees. Plot the input expression with phi ranging from -90 to 90 and you will see this.

POSTED BY: Daniel Lichtblau

Sorry, haven't been near my computer for a while. Having checked, I don't think my suggestion works, I wasn't sure that it would - see attached notebook. But the value of phi in your output is definitely in radians.

Attachments:
POSTED BY: Ian Williams

Thank you for this very nice demonstration. I realised that, in my original function, some of the quantities are in Radians and some are in Degree. Therefore, my results were not consistent.

Thanks for your time.

POSTED BY: abhishek sharma

Thanks for the reply. Can you elaborate : "you could try wrapping the angular variables, x, in Quantity[x,”AngularDegrees”] "

Do you mean I use the command FindMaximum[Cos[phi] (1 - 0.4 Sin[5 Degree + phi]^2), phi "AngularDegrees"]

POSTED BY: abhishek sharma

I’d expect the output to be in radians. All the Degree multiplier does is convert the specified value form degrees to radians. Try typing Degree//N to get its numeric value. If you want to retain the units in the output, you could try wrapping the angular variables, x, in Quantity[x,”AngularDegrees”] - tip, you can generate a nicely formatted version of this Quantity expression by typing ctrl= followed by “x Angular Degrees”. This might return a Quantity result (in this case either radians or angular degrees). I’m not sure whether it would have the desired outcome, but might be worth a go to see what you get.

POSTED BY: Ian Williams

Regarding units of output value

POSTED BY: Ian Williams
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