Skip to content

Conversation

@Alex-Jordan
Copy link
Contributor

This is to address an issue I raised in the thread for #1215.

@pstaabp
Copy link
Member

pstaabp commented Apr 17, 2025

I think it would be a good idea to add these cases to the test suite.

@drgrice1
Copy link
Member

Could you provide a PG example of this? You gave an example mathematically in #1215 (comment), but I am having a hard time producing this in an actual PG problem. For example, I tried the following

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

$vector = Vector(1, 0, 0);

$matrix = Matrix([ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]);

$result = $matrix * $vector;

$result2 = Matrix([ [ 1, 0, 0 ] ]);

BEGIN_PGML
[`[$vector]`] is a [@ ref($vector) @]

[`[$matrix]`] is a [@ ref($matrix) @]

[`[$result]`] is a [@ ref($result) @]

[`[$result2]`] is a [@ ref($result2) @]

[`[$matrix] \cdot [$vector] = [$result]`] is
[$matrix * $vector == $result ?  'true' : 'false']:

[`[$matrix] \cdot [$vector] = [$result2]`] is
[$matrix * $vector == $result2 ?  'true' : 'false']:
END_PGML

ENDDOCUMENT();

That problem renders the same for both the develop branch and this pull request, and the last comparison is an error in both cases. So I must be missing something as to what this is doing.

@Alex-Jordan
Copy link
Contributor Author

Here is a MWE that works in 2.19 and works on this PR's branch. But on develop, gives an error:

DOCUMENT();

loadMacros(qw(PGstandard.pl PGML.pl));

Context("Matrix");
$M = Matrix([1,2], [3,4]);
$s = Vector("<1,2>");
$Ms = $M*$s;
$b = Matrix(0,0)->transpose;

if ($Ms == $b || $Ms != $b) {
BEGIN_PGML
No error!

END_PGML
};

ENDDOCUMENT();

@drgrice1 drgrice1 changed the base branch from develop to PG-2.20 April 29, 2025 12:26
Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MWE that @Alex-Jordan posted shows the error in develop and this fixes it.

Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the issue is fixed.

@somiaj
Copy link
Contributor

somiaj commented May 10, 2025

I also noticed that for the example problem given, that #1223 also fixes the error (unsure if it just fixes the error vs allows the matrices to be accurately compared).

@somiaj
Copy link
Contributor

somiaj commented May 10, 2025

Never mind, I am no longer seeing this fixed with #1223, my dev setup got in some strange state and unsure why switching to that branch had any effect.

@pstaabp pstaabp merged commit 0e40ba2 into openwebwork:PG-2.20 May 13, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

4 participants