Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'max'i'' does not work #444

Closed
siddhesh-padval opened this issue Apr 29, 2023 · 3 comments
Closed

'max'i'' does not work #444

siddhesh-padval opened this issue Apr 29, 2023 · 3 comments

Comments

@siddhesh-padval
Copy link

I am referring to the example given in the book.pdf (page.75) of FORM4.2:

when I run:

#define max1 "2"
#define max2 "3"
AutoDeclare Symbol x;
#do i = 1, 2
#do j = 1, 'max'i''
Local F'i''j' = x^'i''j';
#enddo
#enddo
Print;
.end

I get the following error:
test.frm Line 5 ==> Undefined preprocessor variable max

But when I change
#do j = 1, 'max'i''
to
#do j = 1, 'max{'i'}'

I do get the output as given in the manual.

I was wondering if it's an issue with my text editor or something else.

@jodavies
Copy link
Collaborator

Your pre-processor variable opening character should be a back-tick instead of apostrophe, like so:

#define max1 "2"
#define max2 "3"
AutoDeclare Symbol x;
#do i = 1, 2
#do j = 1, `max`i''
Local F`i'`j' = x^`i'`j';
#enddo
#enddo
Print;
.end

Then the nesting works.

@siddhesh-padval
Copy link
Author

Thank you very much for the explanation.

I was also wondering why Tensors objects do not accept 0 index:

V v1;
T t1;
I [0];
L Vcomp = v1(0) + v1(3);
L Tcomp1 = t1(1,1) + t1(1,2);
L Tcomp2 = t1(0,1);
L Tcomp3 = t1([0],1);
P;
.end

I was expecting that the output will be:
Tcomp2 = t1(0,1);

rather than:
Tcomp2 = 0;

The index 0 works for the vector as expected.

@tueda
Copy link
Collaborator

tueda commented May 1, 2023

Tcomp2 = 0;

This behaviour was introduced in 689b72d, though it is unclear to me whether this was intentional or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants