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

SOLVED
Level 8

## Shows variable is undefined

Hello,

I am trying to work with my final solution but Mathcad is saying the variable is undefined even though it's being defined earlier. I have attached the file. Any help will be really appreciated.

Thank you,

Faisal

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Shows variable is undefined

Is one of the following two function what you are looking for?

or

37 REPLIES 37

## Re: Shows variable is undefined

It's not alpha.1, but psi.ini that is undefined.

Mathcad was never superb at locating exact positions of errors.

Success!
Luc

## Re: Shows variable is undefined

Thank you for your response. What should I do to make it solved

## Re: Shows variable is undefined

Define psi.ini, or take it out of the function, if you don't need it, but I guess you have it in because it serves a purpose. Maybe you are mistaken and meant psi.0 ....?

One thing that will help you, is if you take the immediate evaluation off of the end of the definition.

Just define the psi.new function (in terms of K() and the rest), but do NOT put an equals sign at the end.

See if that goes without error. If there are errors in there, solve those first. Then you can evaluate the function.

Success!
Luc

## Re: Shows variable is undefined

Thank you for your reply. I was trying to generate a final outcome based on successive increments in an if-else statement but it was saying that it did not converge due to infinite recursion.  How will I approach this.

## Re: Shows variable is undefined

Its in no way clear to me what you are trying to do.

Some observations:

"Lambda" is a vector with just one element - is this whats it supposed to be?

"I" is a vector of a couple of values so what do you expect as outcome of your last function? A vector or a scalar.

Main problem is that n is a range and so the condition n=0 in your function never is true leading to an infinite recursion.

## Re: Shows variable is undefined

Is one of the following two function what you are looking for?

or

## Re: Shows variable is undefined

Thank you very much Werner_E. I wanted to be like this.

## Re: Shows variable is undefined

@fahmed-2 wrote:

Thank you very much Werner_E. I wanted to be like this.

Hmm - whichever of the two recursive function I provided you are talking of - there is an easier an direct approach for both of them: