Generic functions: yes, a very good point. I am inclined this way, too, but I was so caught up in the details that I didn't get that far. In truth, the routine needs to be flexible.
>>The routine should not rely that a variable with a specific name exists outside on the worksheet level.
Also a good point. This sheet evolved from points not shown, but I appreciate the reminder...
>>Its tricky and I don't know if it would work in Prime
I don't use Prime much...it's pretty slow, and Help is also awkward. I do try to keep my hand in with it though, and I'll try this in Prime as well once I am happy with it. It needs, too, a bit of a writeup.
>>It looks correct on first sight, but you are assigning g[i,j to g.ij and then you symbolically evaluate that assignment
Whoa! Nice catch. I /did/ see that effect, but didn't understand the implications. I am working in M15, BTW. I built the expression outside of the routine because I couldn't seem to get it to edit properly inside the routine. That is, I could not get the substitute to add to the expression. But I didn't create the whole expressin that way, just the RHS. I tried this several times after your post...
Ahh, this last time worked. I typed g[i,j, clicked Substitute from the Symbolic toolbar, entered x[xn and z, and ///left the expression///. That was the only thing that I did differently. Then when I pasted it, it worked correctly! I suppose (??) that this is because it actually did the symbolic evaluation before the copy|paste?
Great help! I'll keep a copy of this with all the comments and flaws for future reference. I'll post a cleaned up and annotated version for the list. I'll try it in Prime, and post the results.
~R~