Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

Find function

Reinis_B
2-Explorer

Find function

Mathcad Prime 7

 

I'm trying to find solution with solve block, but possibility to find result depends on "x" (would like to find) initial value. How to determine proper "x" initial value? I would like to use Mathcad for automation, but if it's not clear what initial value I must use, it will not be possible. Thank you!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:LucMeekes)


@LucMeekes wrote:

 

It's the 'return from above', the other one is hard(er) to find.

I don't think that the second solution is harder to find, but its not positive so it may not be of interest 😉

Actually there are two negative solutions - one at -0.296 and the other at -249.4.

 

We have two vertical asymptotes and the two solutions are at the left of the leftmost and to the right of the rightmost asymptote.

Werner_E_0-1741812805555.png

 

@Reinis_B 

You demand your solution to be in the interval from 0 to b.p1=0.36. So why a guess of x=1. Actually even higher guess values work OK, but I would rather use b.p1/2, a value sure within the interval the solution is supposed to be.

 

Prime does not help in automatically choosing an appropriate guess value (if Prime could do so, it would not be necessary at all to provide a guess value).

So its up to you to make a good guess, probably based on a plot like the one above.

Looking at this plot it seems that it may better to chose  a guess to the right of the asymptote (greater than 0.151).

 

You may also parametrise the solve block, turning it into a function with the guess value as its argument.

Werner_E_2-1741813088841.png

That way you can easily test various guesses:

Werner_E_3-1741813340843.png

 

As you can see its hard to tell why a guess let the solve block fail. In your case higher guess values seem to be no problem.

Guess values in the range from the vertical asymptote up to 1 (and higher) seem to work all the time.

BTW, it also is dependent on the values of the system variables TOL and CTOL if the calculation fails or not.

But again, looking at the plot it seems not to be wise to use a guess value to the left of the rightmost vertical asymptote.

 

You may write a program which loops through a range of x values and uses "try ... on error...." to catch the errors and returns the values found.

 

You may also make the function get_x additionally dependent of the values lambda and alpha.cc if this is of interest.

 

If we disable the additional constraint we also can get the two negative solutions

Werner_E_4-1741814356671.png

 

 

View solution in original post

5 REPLIES 5
LucMeekes
23-Emerald III
(To:Reinis_B)

I've plotted the left and right side of the equation you're trying to solve:

LucMeekes_0-1741802964895.png

There are two points 'where the two shall meet', but you have to zoom in to find them:

LucMeekes_1-1741803178972.png

Here is one of them:

LucMeekes_2-1741803432407.png

It's the 'return from above', the other one is hard(er) to find.

Success!
Luc

Werner_E
25-Diamond I
(To:LucMeekes)


@LucMeekes wrote:

 

It's the 'return from above', the other one is hard(er) to find.

I don't think that the second solution is harder to find, but its not positive so it may not be of interest 😉

Actually there are two negative solutions - one at -0.296 and the other at -249.4.

 

We have two vertical asymptotes and the two solutions are at the left of the leftmost and to the right of the rightmost asymptote.

Werner_E_0-1741812805555.png

 

@Reinis_B 

You demand your solution to be in the interval from 0 to b.p1=0.36. So why a guess of x=1. Actually even higher guess values work OK, but I would rather use b.p1/2, a value sure within the interval the solution is supposed to be.

 

Prime does not help in automatically choosing an appropriate guess value (if Prime could do so, it would not be necessary at all to provide a guess value).

So its up to you to make a good guess, probably based on a plot like the one above.

Looking at this plot it seems that it may better to chose  a guess to the right of the asymptote (greater than 0.151).

 

You may also parametrise the solve block, turning it into a function with the guess value as its argument.

Werner_E_2-1741813088841.png

That way you can easily test various guesses:

Werner_E_3-1741813340843.png

 

As you can see its hard to tell why a guess let the solve block fail. In your case higher guess values seem to be no problem.

Guess values in the range from the vertical asymptote up to 1 (and higher) seem to work all the time.

BTW, it also is dependent on the values of the system variables TOL and CTOL if the calculation fails or not.

But again, looking at the plot it seems not to be wise to use a guess value to the left of the rightmost vertical asymptote.

 

You may write a program which loops through a range of x values and uses "try ... on error...." to catch the errors and returns the values found.

 

You may also make the function get_x additionally dependent of the values lambda and alpha.cc if this is of interest.

 

If we disable the additional constraint we also can get the two negative solutions

Werner_E_4-1741814356671.png

 

 

Reinis_B
2-Explorer
(To:Werner_E)

Thank you! This will be good solution for me.

LucMeekes
23-Emerald III
(To:LucMeekes)

Actually there are three solutions, as symbolic solving shows:

LucMeekes_0-1741814942244.png

But only the first is positive:

LucMeekes_1-1741814980604.png

Success!
Luc

 

Hi,

The problem is a small concrete section  with one 30 dia bar under  an axial force and bending moment.

It is a good start to take the effective lever arm of compressive concrete to tensile force as 90% of the effective depth of the bar.

As there is no diagram not sure what x stands for or what the section actually looks like?

Cheers

Terry

Announcements

Top Tags