Skip to main content
1-Visitor
September 30, 2016
Question

When iI try to create an array with defined symbols, I get an error message that the symbos shoule be real althouh they have been assigned real values

  • September 30, 2016
  • 47 replies
  • 13897 views

When I define real numbers and try to use it in an array I get the message that one of the symbols needs to be a real number, They are all real numbers. See attached Mathcad file Example.What am I doing incorrectly?

47 replies

24-Ruby IV
September 30, 2016

May be this help you

nvsuryan1-VisitorAuthor
1-Visitor
September 30, 2016

Sorry. I made a mistake in my query. I would like to create two range variables (not arrays) the second one using the first one.

k = 1..10

n = 10

j = 1..(n-2).k

When I try evaluate j I get the error message that k needs to be real.

24-Ruby IV
September 30, 2016

And what result in the end you want to come?

nvsuryan1-VisitorAuthor
1-Visitor
September 30, 2016

Sorry. I made a mistake in my query. I would like to create two range variables (not arrays) the second one using the first one.

k = 1..10

n = 10

j = 1..(n-2).k

When I try evaluate j I get the error message that k needs to be real.

23-Emerald V
September 30, 2016

Narasipur Suryanarayana wrote:

When I define real numbers and try to use it in an array I get the message that one of the symbols needs to be a real number, They are all real numbers. See attached Mathcad file Example.What am I doing incorrectly?

nvsuryan1-VisitorAuthor
1-Visitor
September 30, 2016

Sorry. I made a mistake in my query. I would like to create two range variables (not arrays) the second one using the first one.

k = 1..10

n = 10

j = 1..(n-2).k

When I try evaluate j I get the error message that k needs to be real.

25-Diamond I
September 30, 2016

Narasipur Suryanarayana wrote:

When I define real numbers and try to use it in an array I get the message that one of the symbols needs to be a real number, They are all real numbers. See attached Mathcad file Example.What am I doing incorrectly?

The main question seems to be "What are you trying to?"

You are right when you say that your array k consists only of real numbers and Mathcad is correct when it moans about k not being a real number. k is NOT a real number, k is an array, a  2 x 5 matrix.

WE

nvsuryan1-VisitorAuthor
1-Visitor
September 30, 2016

Sorry. I made a mistake in my query. I would like to create two range variables (not arrays) the second one using the first one.

k = 1..10

n = 10

j = 1..(n-2).k

When I try evaluate j I get the error message that k needs to be real.

23-Emerald I
September 30, 2016

You can't make a range variable that uses another range variable.  You could write   j := 1 . . 80,  (10-2)*10

1-Visitor
September 30, 2016

Sorry. I made a mistake in my query. I would like to create two range variables (not arrays) the second one using the first one.

k = 1..10

n = 10

j = 1..(n-2).k

When I try evaluate j I get the error message that k needs to be real.

What do you want the last element of j to be?

12-Amethyst
October 2, 2016

Hi Werner.

Very interesting implementation, with the introduction of the epsilon, and the mean function.

Also, it seems that you can implement, from there, a general purpose transformation routine. For that, in the while, rows > 2 don't work, but probably can implement an on error statement, for detect when the neccesary rows are not enough for a general transformation T. With more programming tools, like a kind of lasterror function, can catch what error occur evaluating T, but we don't have it.

Best regards.

Alvaro.

25-Diamond I
October 2, 2016

I am pretty sure that we could implement a more general transformation routine. I would add the transformation function and epsilon as function arguments.

We could also get rid of the mode parameter and default it to 0. That way it would not be necessary to store all intermediate matrices but we would use just 2 (the current and the last one). The transformation function should return two results, the vector and an error number which could be used in the main routine for termination in the while loop, replacing the rows>2 condition. As an alternative the tranform function could simply be written so that the input vector is returned in case the number of rows is to small. The main routine would check if the new vector is equal to the last and stop iteration if thats the case.

I am not sure about the mean function I introduced, though. Probably it would be a better idea to just return the last value in the remaining vector.

I also noticed that it does not help to increase the number n of elements in the initial vector of partial sums and decrease epsilon. The accuracy of the result is not increased. Guess we run into numerical round offs and while it would be possible to evaluate symbolically, calculation time is prohibiting (and right now my Mathcad crashed after increasing n just up to 22).

Werner