cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Plz where is the failure

sm�ller-2
11-Garnet

Plz where is the failure

Hey, im encountering an failure here:

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

Thx ! 😃

13 REPLIES 13
-MFra-
21-Topaz II
(To:sm�ller-2)

AA.jpg

Werner_E
24-Ruby V
(To:-MFra-)

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.

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

RichardJ
19-Tanzanite
(To:sm�ller-2)

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.

(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

-MFra-
21-Topaz II
(To:sm�ller-2)

... 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!

Werner_E
24-Ruby V
(To:-MFra-)

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

-MFra-
21-Topaz II
(To:Werner_E)

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.

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!

> 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


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 😃

RichardJ
19-Tanzanite
(To:sm�ller-2)

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):

You have created a function to calculate D.p and the guess value obviously should depend on two of this functions arguments. So the guess D.p should not be static as in your sheet as you need different guess values if you call your function with different values.

Unfortunately we cannot calculate the guess value in the solve block but at least we can pass it as a function argument. So I have chosen that the function which is called to calculate D.p first calculates the guess value and then calls the solve block function with this guess as additional argument. I also added the "onerror" statement to cope for input values which make the solve block fail.

Now you may call this function with scalars or vectors of any size (given they all are of the same dimension).

You did not show if S.Y is a vector or a scalar. If its a vector, you need vectorization, otherwise you should use vectorization but you mustn't.

But I have the impression that you did not want to create a function to be used multiple times with different input values but simply wanted to do the calculations just once but with the values in your vectors one by one. If thats the case you might do it the easy way like this:

WE

Top Tags