Skip to main content
1-Visitor
May 24, 2012
Solved

Mathcad error cannot understand this syntax

  • May 24, 2012
  • 2 replies
  • 4669 views

Hello everyone, i'm a beginner in programming with mathcad. I got 2 problems. First,i must resolve some equations and mathcad give me the error ''cannot understand this syntax'', but i wrote the lines like in the papers , where i go wrong?and second, i got some problems with strings, if anyone could show me where i go wrong please

Best answer by StuartBruff

... the sequential worksheet had the same problem. Corrected in attached, but I haven't checked the algorithms for correctness (but have added a break variant of the for loop).

As a note, Mathcad 12 had some peculiarities that means it computes some things rather strangely from an 'normal' Mathcad perspective. Unfortunately, it's been so long since I've used M12 that I've forgotten what they are ... I think the attached should work in M12, but please let me know if they don't.

Stuart

2 replies

23-Emerald V
May 24, 2012

Claudiu Florin wrote:

Hello everyone, i'm a beginner in programming with mathcad. I got 2 problems. First,i must resolve some equations and mathcad give me the error ''cannot understand this syntax'', but i wrote the lines like in the papers , where i go wrong?and second, i got some problems with strings, if anyone could show me where i go wrong please

Sorry I don't have time to look at the second worksheet, but the first one was fairly easy to fix. You wrote x1, etc using the array index notation for a subscript, whereas you meant the various 'x's to be variable names not array elements. For the latter you need to use the literal subsript ... just type 'x', then '.' then '1' ('2', '3', etc).

Furthermore, your assignment to S will create a nested array, with each element of S holding a single row of your intended result. Whereas some programming languages implement multi-dimensional arrays in this format, Mathcad doesn't. I've shown one way of getting the flat array format that you gave as an example.

Stuart

Message was edited by: StuartBruff Sorry, I realized I'd saved the file as an M15 xmcd not an M12 xmcd. Now saved as an M11 mcd file.

23-Emerald V
May 24, 2012

... the sequential worksheet had the same problem. Corrected in attached, but I haven't checked the algorithms for correctness (but have added a break variant of the for loop).

As a note, Mathcad 12 had some peculiarities that means it computes some things rather strangely from an 'normal' Mathcad perspective. Unfortunately, it's been so long since I've used M12 that I've forgotten what they are ... I think the attached should work in M12, but please let me know if they don't.

Stuart

1-Visitor
May 24, 2012

Thank you mr. Stuart for the help, i'm starting to understand now a little how it works, by the way i use mathcad v15, God bless you !

23-Emerald V
May 24, 2012

Claudiu Florin wrote:

Thank you mr. Stuart for the help, i'm starting to understand now a little how it works, by the way i use mathcad v15, God bless you !

No worries. I don't know why I got the idea Mathcad 12 was involved ... if you see a spare brain cell anywhere, it's mine!

Stuart