Skip to main content
15-Moonstone
February 6, 2022
Solved

Function evaluation. Max value based on range variables

  • February 6, 2022
  • 1 reply
  • 4305 views

Hello!

 

I defined a function depending on one variable. Then I used the range operator for the value which my function depends on. I want to call out the max value of the function based on the range variables. The "max" command doesn't work. I think something is wrong with the equation, since the function can't be evaluated when I type the angle in parenthesis.

Please, take a look ath the attached sheet.

 

Sergey

Best answer by Werner_E

The problem is when you define your function.

You cannot use the convenient convention to write sin^2(x) for sin(x)^2.
If you highlight your function definition and look closely, you  will see an implicit multiplication dot between sin^2 and the opening parenthesis. Obviously that can't work.

The other parenthesis you typed aren't wrong, but not necessary

You have to type it the other way to make it work:

Werner_E_0-1644152905573.png

To find the max value you shouldn't use a range but rather a vector of angles

Werner_E_1-1644153340409.png

Here the max-value is the one at angle zero, for b>a it would be at 90 degree.

Werner_E_2-1644153549063.png

 

 

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
February 6, 2022

The problem is when you define your function.

You cannot use the convenient convention to write sin^2(x) for sin(x)^2.
If you highlight your function definition and look closely, you  will see an implicit multiplication dot between sin^2 and the opening parenthesis. Obviously that can't work.

The other parenthesis you typed aren't wrong, but not necessary

You have to type it the other way to make it work:

Werner_E_0-1644152905573.png

To find the max value you shouldn't use a range but rather a vector of angles

Werner_E_1-1644153340409.png

Here the max-value is the one at angle zero, for b>a it would be at 90 degree.

Werner_E_2-1644153549063.png

 

 

 

Sergey15-MoonstoneAuthor
15-Moonstone
February 6, 2022

Thank you, it works.