Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Iterating mathcad 15

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-30-2015
07:50 AM

01-30-2015
07:50 AM

Hi everybody,

I am trying to make an iterative calculation in Mathcad 15, but I seem to fail. I am trying to calculate rock stability in water by calculating the shear stresses caused by currents and waves. The bed roughness (kr) is a function of the D50 that I am calculating. see the photo. Can anybody tell me what I am doing wrong? If you need more info just ask. Thanks in advance.

Kind regards

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-30-2015
11:16 AM

01-30-2015
11:16 AM

I don't see a reason why you should use vectorization in the calculation of D.50 or tau.p.c. Obvously no vectors are involved.

What you have written is a system of seven equations in seven variables which Mathcad should be able to solve, but only if ...

1) ... you provide guess values for all seven variables and solve for all seven variables, not just for D

2) ... there exists a solution at all, which is not the case. Unless of course you change the logarithm in the expression to calculate C from the log to base 10 to the natural logarithm ln. If you do this you get the solution D=55.3 cm. Of course you also get solutions if you leave it at log and change other values. The point is that the equation has no solution with the values and functions you show in your picture.

As Richard pointed out your system can be significantly simplified because you can calculate one variable after the other for any given D. So the better approach is to set up those variables as functions dependent of 😧

k.r(D):=2*D

C(D):=18*ln(12.35 m/k.r(D))*m^0.5*s^-1

etc.

You will end up with a solve block consisting of just one equation in D.50.

BTW, is there any reason for the multiplication with the factor 1 which you do twice and the multiplication with cos(0) (whch is 1, too)?

5 REPLIES 5

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-30-2015
08:17 AM

01-30-2015
08:17 AM

Re: Iterating mathcad 15

You can't use find in that way. Find is used to solve N equations for N unknowns.

I don't see that you are iterating anything. You start with a value of D50. Based on that you can calculate a value for kr (although don't, you just have an equality), based on that you can calculate a value for C, and so on until you get a new value of D50. All you need is a sequence of numerical assignments. Do you then want to then go through the calculation sequence again? If so, what is the stopping criterion? Do you expect D50 to converge to some value (i.e. it stops changing by any significant amount)? If so, then what you need is a program that loops through the calculations until D50 stops changing.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-30-2015
11:16 AM

01-30-2015
11:16 AM

I don't see a reason why you should use vectorization in the calculation of D.50 or tau.p.c. Obvously no vectors are involved.

What you have written is a system of seven equations in seven variables which Mathcad should be able to solve, but only if ...

1) ... you provide guess values for all seven variables and solve for all seven variables, not just for D

2) ... there exists a solution at all, which is not the case. Unless of course you change the logarithm in the expression to calculate C from the log to base 10 to the natural logarithm ln. If you do this you get the solution D=55.3 cm. Of course you also get solutions if you leave it at log and change other values. The point is that the equation has no solution with the values and functions you show in your picture.

As Richard pointed out your system can be significantly simplified because you can calculate one variable after the other for any given D. So the better approach is to set up those variables as functions dependent of 😧

k.r(D):=2*D

C(D):=18*ln(12.35 m/k.r(D))*m^0.5*s^-1

etc.

You will end up with a solve block consisting of just one equation in D.50.

BTW, is there any reason for the multiplication with the factor 1 which you do twice and the multiplication with cos(0) (whch is 1, too)?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-03-2015
09:56 AM

02-03-2015
09:56 AM

Re: Iterating mathcad 15

Yes I want to go through the calculation sequence again. However, what I have excluded form the above for simplicity is that kr should have a maximum of 0.5m

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-03-2015
10:06 AM

02-03-2015
10:06 AM

Re: Iterating mathcad 15

Hi Werner,

I first used vectors instead of scalars, hence the vectorizations in the formulas, for simplicity I made scalars of the problem.

Thanks for the help, I made everything a function of kr and then I ended up with a solve box of only one variable.

The reason I multiplied with 1 and cos(0) is for simplicity, these values where also variables.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

02-03-2015
10:49 AM

02-03-2015
10:49 AM

Re: Iterating mathcad 15

Glad you found the solution you need but you sure have changed something else, too as the system as shown in your first picture has no solution at all. Given the new 50cm limit you would get 50cm for kr and not the 9cm shown in your new picture. BTW you could write kr=min(2*D50(kr), 50cm) if you like.

I wonder why you had setup D50 to return a vector and use just the first element instead of returning a simple scalar. Usually its a better idea to implement the solve block using scalars, turn it into a function of whatever you want to change and then feed this function an appropriate vector. But it cannot be said if this makes sense without you showing your sheet rather than pictures.

As long as you are happy with the solution its all OK.

BTW, you may turn the solve block into a function dependend on the variables you had set to 1 and 0 for the moment as well.