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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Easy question for Mathcad Users

ptc-6607493
1-Newbie

Easy question for Mathcad Users

I am very beginner user for MathCAD 15.

I have a trouble that I cannot solve myself.

What am I doing wrong in this code ?

1 ACCEPTED SOLUTION

Accepted Solutions

8 REPLIES 8

Capture.PNG

thank you so much to all of you for your answers.

im wondering one more thing, if you will help me again.

we have written that :

for i 0..last(x)

is the "last" word a command for mathcad ? or how does it know that what is last ?

and also the term "rows(x)" does mathcad know what "rows" mean when we write that word ourselves?

for instance sum is a word that we define ourselves completely.

i hope i could state myself clearly.

sorry, i have missed that point, for the rest that is completely helpful.

And other answers also have given me so much thoughts for more advanced to me. thank you.

To, improve myself, can you please help me to find such examples ?

or can you lead me please ?

im a student that i have assigned for this lesson and moreover i wanna continue studying on mathcad.

last(x) and rows(x) are built-in Mathcad functions. You can get a description of their use in the help documentation.

Much simpler approach.

Capture.PNG

Ashley Diana Hogg wrote:

I am very beginner user for MathCAD 15.

I have a trouble that I cannot solve myself.

What am I doing wrong in this code ?

Its hard to debug a picture - you'd better had posted the worksheet itself.

Best guess is that you have not changed the default value of ORIGIN, so its still zero (which is a good idea anyway) but you used a range from 1 to 5 to loop through your vector Grades. Vectors are indexed beginning with the value of ORIGIN, so by default for a 5 element vector this will be 0 to 4. So the usage of 5 may have thrown that error.

As Moe has already shown the task can be acomplished in a much simpler way. If you prefer the functional approach, you may use this:

1.png

for the summation symbol, what should i write for the variable ?

mathcad askes me to define a variable ?

i know there are 2 symbols but i have chosen the simple one that does not require boundaries

Ashley Diana Hogg wrote:

for the summation symbol, what should i write for the variable ?

mathcad askes me to define a variable ?

i know there are 2 symbols but i have chosen the simple one that does not require boundaries

There are actually three summation symbols in Mathcad.

One following the usual mathematical convention with summation variable and lower and upper boundary, the second with only a placeholder at the bottom which should be filled with a range variable and the third without any placeholder (other than the one to hold the expression to be summarized). I used the latter which is to be used to sum up the elements of a vector.

The argument x of the function class has to be a vector of grades. x>=60 creates a vector consisting of 1's and 0's, depending on if the condition is true or not. The sum of this vector therefore gives the number of students having passed the test.

rows, cols, last are predefined Mathcad functions which work on vectors. Look it up in the help. The help in Mathcad is very useful - give it a try.

thank you for your greate answer.

Top Tags