Skip to main content
1-Visitor
July 17, 2019
Solved

Help me

  • July 17, 2019
  • 16 replies
  • 8060 views

hi, I am new using mathcad prime, I have a couple of questions that I would like to help me. I'm sorry for the writing or if you do not understand what I write, my English is basic.
I was working the next function (see attached image)

I would like to add the value of ΦPn_max and 0 to the end of the result of the functions ΦPn and ΦMn respectively, so that the graph closes with the y axis

 

Best answer by Werner_E

Yes, you can't do that with ranges and given the limit use of ranges thats not a real drawback.

Ranges always produce  equally spaced continuous values.

16 replies

23-Emerald IV
July 17, 2019

Welcome to the forum!

Please attach the worksheet. And state which version of Prime you are using.

A picture can tell a thousand words... A worksheet tells infinitely more.

 

Luc

1-Visitor
July 18, 2019

Hi, LucMeekes thanks for answering

A worksheet tells infinitely more ... xD
The worksheet itself does not have much, it is based on a tutorial that I saw on YouTube, on the attached sheet try to improve some things and try to program it in a different way (using vectors elaborated from conditionals besides of the functions in which the work was already). But since I pass the worksheet I will be more specific in the questions.
1. How do I add a value to c_1 (page 1), for example the value of 1, in the third position and how would it be done to place it at the end?
2. c_1 Is not considered a vector? What is it?
3. From the function f_s (i, c_1) (page 1), what is the sequence that the program follows? If I check the values ​​of ε_t the program first evaluates the values ​​of i together with the first value of c_1, before move to the next value of c_1, however the general function f_s (i, c_1) first exhausts the values ​​of c_1 before moving to the next value of i. The general sequence is what designates the order of evaluation or varies depending on whether it is a function or only the evaluation of variables?
4. Like question one, I would like to add a value to the response of a function for example to ΦMn (c_1) (page 3)
5. I would like to have, for example, the values ​​from 102 to 202 of the vector f_s (i, c_1), in another side the values ​​from 203 to 303 ...
version Prime 5.0.0.0

 

25-Diamond I
July 18, 2019

1. How do I add a value to c_1 (page 1), for example the value of 1, in the third position and how would it be done to place it at the end?

You can't do that because c_1 is a range, not a vector!

 

2. c_1 Is not considered a vector? What is it?

Its a range. A range is sort of an implicit loop. You should use ranges for three purposes only:
- index a vector or matrix

- in program (for loop)

- for plotting to have more control than quickplot provides

BTW, I consider it a design error that in Prime ranges and vector look exactly alike when displayed

To read more about ranges vs. vectors you may check the articles of Stuart Bruff which I attached here:

https://community.ptc.com/t5/PTC-Mathcad/How-to-Calculate-Gain-and-Phase/m-p/475811/highlight/true#M172174

Being rather old they still apply, though.

EDIT: Just noted that the pdf in the thread above is corrupt. This forum really is ... very special 😞

I attach the file here.

 

3. From the function f_s (i, c_1) (page 1), what is the sequence that the program follows? If I check the values ​​of ε_t the program first evaluates the values ​​of i together with the first value of c_1, before move to the next value of c_1, however the general function f_s (i, c_1) first exhausts the values ​​of c_1 before moving to the next value of i. The general sequence is what designates the order of evaluation or varies depending on whether it is a function or only the evaluation of variables?

When you define a function, what you use are so called formal parameters (formal arguments). The name of those arguments does not matter at all. So your function is the very same as
B.png, no difference. So the c_1 and i you used when defining the function have absolutely nothing to do with the variables of same name you defined right above (you probably can abandon that variable definition, unless you need them later for something else).

Evaluation of the function only takes place when you later call it, providing actual arguments

B.png

For d, etc. the evaluation is using the values which where valid when you defined the function. If you changed them afterwards, this has no effect on the function outcome.

 

4. Like question one, I would like to add a value to the response of a function for example to ΦMn (c_1) (page 3)

No, thats a different question 😉 In question 1 you wanted to add a value to a range, which is not possible. But now you are asking for changing the output of a function. If you want to change the output of a function, you have to change the function definition. You may do this using if..else statements. E.g. "if c_1>h .... else ...."

Keep in mind that in your sheet c_1 is a range. if you call ΦMn (c_1) the result is something which looks like a vector, but isn't (its not a range,too). You can use it only for plotting (or to display the values). If you try to access the third element by typing ΦMn (c_1)[4 it will fail. If you try to assign the outcome to a variable via x:=ΦMn (c_1) it will fail. You remember: Use ranges in three situations only!

 

5. I would like to have, for example, the values ​​from 102 to 202 of the vector f_s (i, c_1), in another side the values ​​from 203 to 303 ...

Sorry, I don't understand that question. And  f_s (i, c_1) is not a vector!

 

A word of caution: The "stack" command Terry was talking about only applies to vectors, NOT ranges!


 

21-Topaz II
July 18, 2019

Hi,

 

The top of the moment/axial interaction diagram can be approximated by a straight line.

Simply plot a second line between the two end points using the same plot style as the existing curve.

 

Cheers

Terry

1-Visitor
July 18, 2019

Hi, terryhendicott

Thanks for answering. Regarding what you tell me it is a good idea to complete the diagram. But what I want is a way to enter a value within a variable or a function already defined for example I would like to add the value one to the variable c_1(see attached image) (I say variable and not vector because since it was defined the program does not recognize it as a vector). How can I add the value 1 either where it corresponds in increasing order and how can I place it at the end or at the beginning, is this possible? All this I do in order to generalize results to be able to write something that works for other occasions.

21-Topaz II
July 18, 2019

Hi,

 

You can add to the top or bottom of a vector or matrix with the "stack" command.  Look it up in help if you are unsure.

You can add more columns to a vector or matrix with the "augment" command.

 

Is this what you are after?

 

Cheers

Terry