Open jmbrod opened 7 months ago
The last thing first: If you print the expression with the rat it probably has rat(-y+x,y) and because of that your substitution does not work.
Then the first: the polyratfun acts as the coefficient of the term. And in the same way that you cannot replace the 4/7 in the term 4/7*x you cannot replace the polyratfun.
You could however use the following statement
Multiply replace_(rat,f);
and have a look what you obtain.
On 17 Nov 2023, at 19:14, Joachim Brod @.***> wrote:
Hi,
I have the following problem: I use polyratfun and then in the end would like to make a substitution of a the polyratfun function. The following is a minimal example:
s x,y; cf rat,f;
l exp = rat(x-y,y) ;
.sort polyratfun rat; id rat(x-y,y) = f(x-y,y) ;
print +s; .end This gives rat(x - y,y) while I would expect f( - y + x,y). On the other hand, just not using polyratfun works (but this is not an option in my actual code):
s x,y; cf rat,f;
l exp = rat(x-y,y) ;
id rat(x-y,y) = f(x-y,y) ;
print +s; .end gives the desired result. I tried to "undo" the polyratfun by
s x,y; cf rat,f;
l exp = rat(x-y,y) ;
.sort polyratfun rat; .sort polyratfun; id rat(x-y,y) = f(x-y,y) ;
print +s; .end but still, rat does not get replaced by f. Probably I'm missing something quite basic...?
Thanks for any help / clarification!
— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/464, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEWDYIMHBDFTMHJAYHLYE6SQ3AVCNFSM6AAAAAA7QFNX2WVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TSNRYGE2TQMA. You are receiving this because you are subscribed to this thread.
In your first example you certainly can replace the rat
if you use wildcards.
id rat(x?,y?) = f(x,y) ;
will make the replacement that you seem to want.
It will leave a rat(1,1)
leftover, since polyratfun
is still enabled. If you disable it again as in your last example, you end up with only f(x - y,y)
.
Your last example is a bit weird. For me it prints as rat(x - y,y)
and yet your id statement still does not match. This is something to do with polyratfun's sort ordering; if you run your script with On highfirst;
at the start, your last example works as you would expect.
OK, maybe I was to fast with my answer…..
On 17 Nov 2023, at 19:34, jodavies @.***> wrote:
Your last example is a bit weird. For me it prints as rat(x - y,y) and yet your id statement still does not match. This is something to do with polyratfun's sort ordering; if you run your script with On highfirst; at the start, your last example works as you would expect.
— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/464#issuecomment-1816904788, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCESUAJQNZV25HUEBIPTYE6UZ3AVCNFSM6AAAAAA7QFNX2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWHEYDINZYHA. You are receiving this because you commented.
Hi, thank you for your quick replies! Yes, I thought the last example was weird :-) The sorting explanation makes sense, and I think in practice I might just use the replace_ function.
This is something to do with polyratfun's sort ordering;
Indeed, inserting argument;endargument;
(force it to change the sort ordering) is a workaround (see also #144):
s x,y;
cf rat,f;
l exp = rat(x-y,y) ;
.sort
polyratfun rat;
.sort
polyratfun;
argument;endargument; * <-- inserted
id rat(x-y,y) = f(x-y,y) ;
print +s;
.end
FORM 4.3.1 (Apr 11 2023, v4.3.1) 64-bits Run: Mon Nov 20 13:50:00 2023
exp =
+ f( - y + x,y)
;
Hi,
I have the following problem: I use polyratfun and then in the end would like to make a substitution of a the polyratfun function. The following is a minimal example:
This gives
rat(x - y,y)
while I would expectf( - y + x,y)
. On the other hand, just not using polyratfun works (but this is not an option in my actual code):gives the desired result. I tried to "undo" the polyratfun by
but still,
rat
does not get replaced byf
. Probably I'm missing something quite basic...?Thanks for any help / clarification!