Skip to main content
1-Visitor
April 13, 2016
Question

Plz where is the failure

  • April 13, 2016
  • 13 replies
  • 2976 views

Hey, im encountering an failure here:

I want to use for every row another Dp as shown here:

Thx ! 😃

13 replies

21-Topaz II
April 13, 2016

AA.jpg

25-Diamond I
April 13, 2016

Using Dp as variable name AND function name may be confusing and may not be good style (I would avoid it),  but definitely it IS allowed.

25-Diamond I
April 13, 2016

Not much can be said about your picture as we don't see the type (scalars, vectors) of your various variables.

You also don't reveal why you think that you are experiencing is a failure.

Probably Mathcad is doing right anyway. Could it be that you simply don't know that you can tell Mathcad to show nested matrices via format menu?

Otherwise - explain what the failure is in your opinion and maybe you can post a simplified (!!!) worksheet to demonstrate the faiilure.

WE

19-Tanzanite
April 13, 2016

Like Werner, it's not clear to me what the problem is. Do you want to use a different guess value for Dp for each row in the answer? If so, just add it to the argument list. Using Dp as both the function name for the solve block and the solve variable is really confusing, and it will be even more so if you add Dp to the argument list (it may even cause an error). I suggest you use a different function name.

25-Diamond I
April 13, 2016

(it may even cause an error).

I guessed it would throws an error, but it doesn_t 😉

Nevertheless its bad style and something which should be avoided.

Werner

21-Topaz II
April 13, 2016

... Gentlemen !!!

with a little imagination, we should give a function a name other than a variable! ...is it possible that a function with parameters, should have the same name as a variable? Despite that this is permissible in mathcad as demonstrated by W. E., I always avoid to fall into this ambiguity ... so I would consider it, not allowed!

25-Diamond I
April 13, 2016

I think we can agree on that its bad style and, as we all wrote, we would avoid it.

Nevertheless I would not consider it "not allowed" as we are not in the position to allow or disallow other people, especially Stefan, what they have to do or not. We can only advise that from our experience doing so is not favorable and can lead to confusion.

Mathcad handles the situation confidently and correct and so if Stefan wants to name  function and formal argument the same, he sure is allowed to do so, even if we advise against doing so.

The point is - From what we see, using the same name sure is not the cause for any failure, Stefan may be experiencing. Changing the name would not help as it would not change anything - other than making us happy as we consider it better style

21-Topaz II
April 13, 2016

Hello Werner, ...

Binary logic much influence the character of those who use it for a long time ... high, or low, ... 0 ... 1 ... there is no other choice. This applies to machines ... but we humans can "close an eye." Indeed we do so frequently in everyday life. I marvel that mathcad have learned this behavior or has been programmed taking that into account ....

Best regards

F. M.

1-Visitor
April 13, 2016

Hey thx for input.

My problem is that i need the Search function and i need a certain starting point for searchig.

The input parameters are all normal values and the starting point for the search function is depends for every row (loadcase)

I think werners post is the right one.:

Werner: 13.04.2016 02:45


i still dont know what nestet matrices are. I was thinking it as a failure because the output is not a normal vector.


Im gonna try tomorrow.


Thx!

25-Diamond I
April 13, 2016

> The input parameters are all normal values

The functions arguments may be scalars, but it seems to me that the guess value for Dp is a 2x1 matrix and thats the reason your function Dp returns a 2x1 matrix for every set of input values.

Was that intended and done on purpose?

> i still dont know what nestet matrices are.

We talk of nested matrices when the element of a matrix is a matrix (or vector) itself.

Displaying nested matrices can easily go unclear and confusing, so the default setting is not to show matrix elements which are matrices themselves but rather represent them via their dimensions, So {2,3} means that the element is 2 x 3 matrix (two rows, three columns).

If we (can) display a matrix as matrix (and not as table), we have the option, to display the "inner" matrices as well.

Now, why did you get nested matrices? We still don't know much about your variables, but I guess, that your function Dp() returns a 2 x 1 vector when called with simple scalar arguments.

When you call it vectorized with a vector of scalars as argument, the values of that vector will be fed in your function one after the other and the results (a 2x1 vector for every call) are collected in a result vector - you will end up with a vector consisting of a number of those 2x1 vectors.

If you need another data structure, you will have to write a small program to turn the nested matrix into whatever structure you expected. - maybe a n x 2 matrix?

WE


1-Visitor
April 14, 2016

Ok here is my input for the search function:

as to see my guess value is a Vector with 2 rows. Here: 25.35 for the first and the same value for the second.

It is also possible that the input vector for startening the iteration has different values for the rows. For example: 25.35 (first and 120 for the second).

It is also possible that i have more than 2 rows.

So as to say i want to do the Iteration for every row. And mathcad should take the vector (Dp, here 25,35 anf 25.35) as startening point for the iteration for every row independend.

The solution here should be 67.92 and 65.64.

Thx 😃

19-Tanzanite
April 14, 2016

Try removing the vectorization. If that does not work for some reason, pass the guess values as an argument to the function Dp (this is really the preferred solution anyway, because it should always work):