Question: why this match fail, but patmatch works on same input?

any idea what match fail on this example? is somethinbg wrong I am doing?

interface(version);

`Standard Worksheet Interface, Maple 2025.1, Linux, June 12 2025 Build ID 1932578`

restart;

A:=2*y(3)^4+5;
match(A=k1*y(k2)^k3+k4,y,'la')

2*y(3)^4+5

false

patmatch(A,k1::anything*y(k2::anything)^(k3::anything)+k4::anything,'la');
la

true

[k1 = 2, k2 = 3, k3 = 4, k4 = 5]

Download why_match_fail_sept_21_2025.mw

Update:
I think match can only do it if the main "variable"   is a variable and not a "function". In this example y(.) is function, so that is why it failed to match. For example this works:

A:=2*y^3+4;
match(A=k1*y^k2+k3,y,'la')

And gives true, since "y" here is not a "function".

But this makes match not very useful to use for parsing. patmatch seems a little more practical to use.

Please Wait...