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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

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

nvsuryan
1-Newbie

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

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 47

May be this help you

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.

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.

And what result in the end you want to come?

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.

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.

StuartBruff
23-Emerald II
(To:nvsuryan)

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?

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.

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.

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.

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

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.

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

Thank you for your clarification that I cannot make a range variable that uses another range variable. Now I know how to program using range variables.Your clarification has been very helpful.

Hi Fred.

Fred Kohlhepp wrote:

You can't make a range variable that uses another range variable.  ...

Absolutely right. But the reason is obscure to me:

FIG.gif

Best regards.

Alvaro.

Which values should the second range consist of in your opinion?

(Not to mention that a range does NOT consist of any values but rather is an implicit loop)

When you write j:=1 .. N then you create the range 1, 2, 3, 4, 5, .... up to N. So N has to be a real number, the upper limit.

When k is a range, then (n-2)*k sure is not a real number. so what should the end value of your range j be?

Or do you mean the the range j should be 8, 16, 32, .... up to 80?

Then you could do it so:

n := 10

k := 1 .. n

j := (n-2), 2*(n-2) .. n*(n-2)

BTW, do you really need a range or would you rather prefer a vector?

What do you intend to use j for later in your sheet?

WE

What I am trying to do is to use these values inside a program for iteration. So I would like to use them as range variables with a fixed n, k and j as the counters. n could be a large number. I am trying to get the numerical solution for a series using Shank's transformation. Does this help? If not I could send the program that I am trying to execute with two counters k and j for a fixed n which could be as large as 50.

Kindly let me know if you would like to see the program. Maybe you could suggest a different way of programming.

Inside a program you don't use ranges like in standalone calculations but rather use for-loops, which have a similar syntax as range definitions.

So it would be a better idea if you attach a worksheet with your program or what you tried so far and a clear explanation which shows which result you expect.

Stripping down and simplifying the worksheet might help to attract more helpers, provoke more concise answers and may also help you to better understand the underlying principles.

Thank you for your offer. I am attaching a file where I am using Shank's transformation to sum a series. I would like to automate the process in Mathcad. In case you need a brief explanation of the transformation, please let me know.

Hi Narasipur.

Hope this helps.

Best regards.

Alvaro.

fig.gif

Thank for educating me. I will try to use your suggestion and that of WE (Werner) and if there is any problem I will seek your assistance again. I hope you have to time to solve any issue that I may face.Thanks again.

I hope you have the time to answer one more query.

I could use your suggested program. Evaluating each individual y(k) with k going from 1 to n when n is a large number is a laborious task, Is it possible to program it so that only y(n) is the output?

Your 85+ year old student will appreciate your suggestion.

Hi Narasipur.

Hope that I can sometime get your age, and continue to study.

I guess that what you ask is answered by Werner, who write a function for use all the avaible data in the succession values.

Best regards.

Alvaro.

Thanks for your kind words. I am having trouble implementing WE's suggestion in creating the initial series. I am in touch with him(her?)

Hello Mr. Diaz:

I was able to navigate successfully through Mr. Werner's suggested program. The responses by Mr. Werner and yourself are greatly appreciated.

Here is a routine which might be useful. Its a quick hack with no error checking and the iteration stops when the vector has just 1 or 2 elements. It would also be possible to stop the iteration when the difference of the first and last element in the vector is lower than a given threshold. The second "mode" parameter decides if just a single result is returned or the full series of vectors.

Here is your example

and here is a further example from Shanks transformation - Wikipedia, the free encyclopedia

Regards

Werner

So here is a different version of the shanks routine which probably is better readable, I guess. Alvaros "T" - function is now a local function to "shanks" and the threshold value is implemented.

Thank for educating me. I will try to use your suggestions and that of Diaz and if there is any problem I will seek your assistance again. I hope you have to time to solve any issue that I may face.Thanks again.

When I try to create y(subscript)series as shown in to create initial series with n = 11, I get the message "this variable is undefined." What am I doing wrong?

Top Tags