Trouble finding location of the maximum of f(x) function using derivatives

Trouble finding location of the maximum of f(x) function using derivatives - I am trying to find the location where maximum moment occurs. I have - Messages

#1 Posted: 8/14/2025 4:03:29 PM
DM

DM

0 likes in 12 posts.

Group: User

Hello all,

I am trying to develop a method to calculate the location of maximum moment using the superposition method. My thought was to create an expression M(x), take the derivative = 0 which would be the location of maximum moment.

However, I'm not sure why the solver isn't returning any roots. Is this a problem because my variables have units?

I read into https://smath.com/en-US/forum/topic/WRWWAT/Max-value-of-function thread and the second post had an example file, but my function was not working in there when I tried replacing it.

As an aside, what is the vertical bar in this photo called and what is it's purpose? I tried searching for it but I have no clue what it is even called. Same goes for the arrow above the f(x_c).



Moment Test.sm (30.71 KiB) downloaded 65 time(s).
Edited 8/14/2025 4:08:28 PM
#2 Posted: 8/15/2025 2:26:25 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,039 likes in 1,703 posts.

Group: User

Hi. Yes, you are right, there is a problem with the units. This is a way for handle units using solve:

image.png

About the line() instruction in the examples that you mention, as in smath the calculations are performed from left to right and from top to bottom, it is simply used so that the graph on the right can be drawn, otherwise it would have to be placed below.

Your problem solved using the procedures in the reference:

maximun.sm (51.09 KiB) downloaded 57 time(s).

Best regards.
Alvaro.
Edited 8/15/2025 3:53:03 AM
2 users liked this post
sergio 8/15/2025 9:36:51 AM, ioan92 8/15/2025 9:39:10 AM
#3 Posted: 8/15/2025 11:54:25 AM
StvMath

StvMath

38 likes in 62 posts.

Group: User

It works like this:

moment.png
#4 Posted: 8/15/2025 2:02:35 PM
DM

DM

0 likes in 12 posts.

Group: User

Wrote

It works like this:

moment.png



Hello! For your x solve how come you put h in the brackets when it is a constant? The post above yours doesn't have as many inputs but appears to accomplish the same thing. What are the extras in your solve call doing?
#5 Posted: 8/15/2025 2:03:18 PM
DM

DM

0 likes in 12 posts.

Group: User

Wrote

Hi. Yes, you are right, there is a problem with the units. This is a way for handle units using solve:

image.png

About the line() instruction in the examples that you mention, as in smath the calculations are performed from left to right and from top to bottom, it is simply used so that the graph on the right can be drawn, otherwise it would have to be placed below.

Your problem solved using the procedures in the reference:

maximun.sm (51.09 KiB) downloaded 57 time(s).

Best regards.
Alvaro.



Is there a way to have the solve only spit out the positive number for x instead of a matrix?
#6 Posted: 8/15/2025 3:11:45 PM
StvMath

StvMath

38 likes in 62 posts.

Group: User


Hello! For your x solve how come you put h in the brackets when it is a constant? The post above yours doesn't have as many inputs but appears to accomplish the same thing. What are the extras in your solve call doing?

The '0' and the 'h' are the limits of x between which 'solve' searches for a solution.
#7 Posted: 8/15/2025 6:41:53 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,039 likes in 1,703 posts.

Group: User

Wrote

... Is there a way to have the solve only spit out the positive number for x instead of a matrix?


Hi DM. There are several ways. This two, for example:

image.png

Moment Test.sm (33.91 KiB) downloaded 44 time(s).

Wrote

... Hello! For your x solve how come you put h in the brackets when it is a constant? The post above yours doesn't have as many inputs but appears to accomplish the same thing. What are the extras in your solve call doing? ....


Hi Stv. Which solve?

Best regards.
Alvaro.
#8 Posted: 8/15/2025 7:40:12 PM
StvMath

StvMath

38 likes in 62 posts.

Group: User


Hi Stv. Which solve?

Best regards.
Alvaro.



Hi Alvaro,

Not sure what you're getting at! I simply took the 'solve' that DM had used and added the two limits (0 and h), as well as inserting units.

Best regards,
Stv.
1 users liked this post
Alvaro Diaz Falconi 8/15/2025 10:07:35 PM
#9 Posted: 8/15/2025 10:19:04 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

1,039 likes in 1,703 posts.

Group: User

Wrote

... Not sure what you're getting at! I simply took the 'solve' that DM had used and added the two limits (0 and h), as well as inserting units. ...


It seems my browser didn't load the image you attached when I ask about which solve. I just saw your image now. You're right; the most practical way is to limit the search to the range [0, h].

Best regards.
Alvaro.
  • New Posts
  • No New Posts