maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
138 stars 147 forks source link

tmp[i,j] #1173

Closed yositomi-opu closed 2 months ago

yositomi-opu commented 2 months ago

I'm encountering an issue when I define tmp[i,j] := rand(5) - 3 in the question variables. The system generates an error saying, 'tmp should have one index, but has a double index.' in the feedback message. It seems like the keyword 'tmp' might be globally reserved in STACK, causing a conflict with the user-defined 'tmp'. Is this correct? Changing not to use tmp, lambda([i,j],rand(5)-3) instead, the issue do not happen. Any insights or solutions would be greatly appreciated. Thank you.

Please forgive me if this issue is already known and has been fixed. I'll contact the system admin to update STACK.

sangwinc commented 2 months ago

Please can you confirm the version you are using? I can't reproduce the problem in the "development" branch. Instructions on how to find your version are here: https://docs.stack-assessment.org/en/Authoring/Author_FAQ/#which-version-of-stack-do-i-have

yositomi-opu commented 2 months ago

Sorry for the lack of information. The question did work correctly in STACK 4.2, but in the version 'STACK 2023121100' it does not work. Thanks in advance.

yositomi-opu commented 2 months ago

The messege was: ノード{$a->node}は以下のランタイムエラーを引き起こしました。([en]: The node ($a->node) has ocrrured the following runtime error) evaluation: array tmp must have 2 indices; found: tmp[1]

I cannot attache xml or .txt file, so paste by pbcopy(sorry for japanese).


<?xml version="1.0" encoding="UTF-8"?>

d2.行列の積の定義(整数入力形式) (error case)

次の各行列について, 積 AB, BA が定義されているか答えよ.

定義されているならば型を答え, 定義されていないならば  \(0\times 0\) と答えよ.

(1) \( A = \) {@PA[1]@}, \( B = \) {@PB[1]@}

積 \(AB\) の型 : [[input:ans111]] \(\times\) [[input:ans112]], 積 \(BA\) の型 : [[input:ans121]] \(\times\) [[input:ans122]]

[[validation:ans111]][[validation:ans112]][[validation:ans121]][[validation:ans122]]

(2) \( A= \) {@PA[2]@}, \(B = \) {@PB[2]@}

積 \(AB\) の型 : [[input:ans211]] \(\times\) [[input:ans212]] , 積 \(BA\) の型 : [[input:ans221]] \(\times\) [[input:ans222]]

[[validation:ans211]] [[validation:ans212]][[validation:ans221]] [[validation:ans222]]

(3) \(A = \) {@PA[3]@}, \(B = \) {@PB[3]@}

積 \(AB\) の型 : [[input:ans311]] \(\times\) [[input:ans312]], 積 \(BA\) の型 : [[input:ans321]] \(\times\) [[input:ans322]]

[[validation:ans311]] [[validation:ans312]] [[validation:ans321]] [[validation:ans322]]

 

]]>
行列の積 \(AB\) は \(A\) の列の数と \(B\) の行の数が一致していると定義されます.

\(AB\) の \( (i,j) \) 成分は \(A\) の \( i \) 行と \(B\) の \( j \) 列の積になります.

]]>
1 0.1 0 2023121100 [[feedback:prt1]]

[[feedback:prt2]]

[[feedback:prt3]]

 

]]>
{@rclist[1]@}, {@rclist[2]@}, {@rclist[3]@} 0 0 0 Correct answer, well done.

]]>
Your answer is partially correct.

]]>
Incorrect answer.

]]>
. none 1 i cos-1 lang ( ans111 numerical ca11[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans112 numerical ca11[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans121 numerical ca12[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans122 numerical ca12[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans211 numerical ca21[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans212 numerical ca21[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans221 algebraic ca22[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans222 algebraic ca22[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans311 algebraic ca31[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans312 algebraic ca31[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans321 algebraic ca32[1] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 ans322 algebraic ca32[2] 4 1 0 0 limit,determinant,integrate 1 0 0 0 0 prt1 1.0000000 1 1 ans11: [ans111,ans112]; ans12: [ans121,ans122]; 0 AlgEquiv ans11 ca11 1 = 0 1 1-0-T = 0 2 1-0-F 1 AlgEquiv ans12 ca12 1 = 1 -1 1-1-T (1) 正解です.

]]>
= 0.5 -1 1-1-F (1) AB は正しいですが, BA は正しくありません.

]]>
2 AlgEquiv ans12 ca12 1 = 0.5 -1 1-3-T (1) BA は正しいですが, AB は正しくありません.

]]>
= 0 -1 1-3-F (1) AB も BA も正しくありません.

]]>
prt2 1.0000000 1 1 ans21: [ans211,ans212]; ans22: [ans221,ans222]; 0 AlgEquiv ans21 ca21 0 = 0 1 prt2-1-T = 0 2 prt2-1-F 1 AlgEquiv ans22 ca22 0 = 1 -1 prt2-2-T (2) 正解です.

]]>
= 0.5 -1 prt2-2-F (2) AB は正しいですが, BA は正しくありません.

]]>
2 AlgEquiv ans22 ca22 0 = 0.5 -1 prt2-3-T (2) BA は正しいですが, AB は正しくありません.

]]>
= 0 -1 prt2-3-F (2) AB も BA も正しくありません.

]]>
prt3 1.0000000 1 1 ans31: [ans311,ans312]; ans32: [ans321,ans322]; 0 AlgEquiv ans31 ca31 0 = 0 1 prt3-1-T = 0 2 prt3-1-F 1 AlgEquiv ans32 ca32 0 = 1 -1 prt3-2-T (3) 正解です.

]]>
= 0.5 -1 prt3-2-F (3) AB は正しいですが, BA は正しくありません.

]]>
2 AlgEquiv ans32 ca32 0 = 0.5 -1 prt3-3-T (3) BA は正しいですが, AB は正しくありません.

]]>
= 0 -1 prt3-3-F (3) AB も BA も正しくありません.

]]>
558945548 779581872 411856786 722502025 1482492471 1 管理者のインプットを想定したテストケースは満点です。 ans111 ca11[1] ans112 ca11[2] ans121 ca12[1] ans122 ca12[2] ans211 ca21[1] ans212 ca21[2] ans221 ca22[1] ans222 ca22[2] ans311 ca31[1] ans312 ca31[2] ans321 ca32[1] ans322 ca32[2] prt1 1.0000000 0.0000000 1-1-T prt2 1.0000000 0.0000000 prt2-2-T prt3 1.0000000 0.0000000 prt3-2-T
sangwinc commented 2 months ago

Could you please email the .xml to me at C.J.Sangwin@ed.ac.uk? I'll take a look. Chris

sangwinc commented 2 months ago

Yes, it is possible that "tmp" was globally reserved by mistake in that version. I can't reproduce the error on either the latest release (2024012900) or in the development code in "dev" branch. Thanks for reporting it, and I'm very sorry this has caused you a problem.

yositomi-opu commented 2 months ago

Thanks. I report to administrator and asked to update.