Dear group, I cannot figure out why the calculations inside [expr (x*cos(theta))-(y*sin(theta));(x*sin(theta))+(y*cos(theta))] gives me wrong results. The above mentioned formula for rotation is correct. I initialize the values through [value] object before preforming computation. The initial values are: x=1, y=0, theta=1/2pi. I expect the new x and new y to be (0,1) respectively after the rotation. But, for some reason, I get (-1,1). I checked the help files for [value] and [expr] and it looks like I am doing everything right. Anyone have an idea where's the mistake?Thank you!Hrvoje Radnic https://www.instagram.com/singlecycled/
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://soundcloud.com/sumovi-protiv-valova 00385(0)915225162
Are you by any chance updating x before running the y calculation? If you do that, y will be calculated using the updated x and not the correct (original) one.
cheers Miller
On 11/29/25 6:49 AM, Hrvoje Radnic via Pd-list wrote:
Dear group,
I cannot figure out why the calculations inside [expr (x*cos(theta))-(y*sin(theta)); (x*sin(theta))+(y*cos(theta))] gives me wrong results.
The above mentioned formula for rotation is correct. I initialize the values through [value] object before preforming computation. The initial values are: x=1, y=0, theta=1/2pi. I expect the new x and new y to be (0,1) respectively after the rotation. But, for some reason, I get (-1,1). I checked the help files for [value] and [expr] and it looks like I am doing everything right. Anyone have an idea where's the mistake? Thank you! Hrvoje Radnic
https://www.instagram.com/singlecycled/ https://urldefense.com/v3/__https://www.instagram.com/singlecycled/__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhNcNbhmE$
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://urldefense.com/v3/__https://pdvrecords.bandcamp.com/album/umovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhEqqX9g8$ https://soundcloud.com/sumovi-protiv-valova https://urldefense.com/v3/__https://soundcloud.com/sumovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhLRt9iry$ 00385(0)915225162
pd-list@lists.iem.at - the Pure Data mailinglist https://urldefense.com/v3/__https://lists.iem.at/hyperkitty/list/pd-list@lis...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://urldefense.com/v3/__https://lists.iem.at/__;!!Mih3wA!DfrXKhsjBltnmdI...
Thank you Miller for your suggestion. I don't think that's the case, I checked the order of operations with [print] and everything looks like it should. I even made the signal version of the whole [expr] computation in order to bypass the possibility of wrong order and the result is repeated there as well. So, it must be math inside [expr], but I really struggle to find any clue. Hrvoje Radnic https://www.instagram.com/singlecycled/
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://soundcloud.com/sumovi-protiv-valova 00385(0)915225162
On Saturday, November 29, 2025 at 04:40:48 PM GMT+1, Miller Puckette via Pd-list <pd-list@lists.iem.at> wrote:
Are you by any chance updating x before running the y calculation? If you do that, y will be calculated using the updated x and not the correct (original) one.
cheers Miller
On 11/29/25 6:49 AM, Hrvoje Radnic via Pd-list wrote:
Dear group,
I cannot figure out why the calculations inside [expr (x*cos(theta))-(y*sin(theta)); (x*sin(theta))+(y*cos(theta))] gives me wrong results.
The above mentioned formula for rotation is correct. I initialize the values through [value] object before preforming computation. The initial values are: x=1, y=0, theta=1/2pi. I expect the new x and new y to be (0,1) respectively after the rotation. But, for some reason, I get (-1,1). I checked the help files for [value] and [expr] and it looks like I am doing everything right. Anyone have an idea where's the mistake? Thank you! Hrvoje Radnic
https://www.instagram.com/singlecycled/ https://urldefense.com/v3/__https://www.instagram.com/singlecycled/__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhNcNbhmE$
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://urldefense.com/v3/__https://pdvrecords.bandcamp.com/album/umovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhEqqX9g8$ https://soundcloud.com/sumovi-protiv-valova https://urldefense.com/v3/__https://soundcloud.com/sumovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhLRt9iry$ 00385(0)915225162
pd-list@lists.iem.at - the Pure Data mailinglist https://urldefense.com/v3/__https://lists.iem.at/hyperkitty/list/pd-list@lis...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://urldefense.com/v3/__https://lists.iem.at/__;!!Mih3wA!DfrXKhsjBltnmdI...
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/HB5NXTYHAO...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
it works here, double check your order of operations:
#N canvas 131 195 450 300 12; #X msg 119 70 1 0 1.5708; #X floatatom 119 140 15 0 0 0 - - - 0; #X floatatom 361 137 5 0 0 0 - - - 0; #X obj 119 95 expr ($f1*cos($f3))-($f2*sin($f3)) ; ($f1*sin($f3))+($f2*cos($f3)); #X connect 0 0 3 0; #X connect 3 0 1 0; #X connect 3 1 2 0;
Antoine
Le dim. 14 déc. 2025 à 11:56, Hrvoje Radnic via Pd-list < pd-list@lists.iem.at> a écrit :
Thank you Miller for your suggestion. I don't think that's the case, I checked the order of operations with [print] and everything looks like it should. I even made the signal version of the whole [expr] computation in order to bypass the possibility of wrong order and the result is repeated there as well. So, it must be math inside [expr], but I really struggle to find any clue.
Hrvoje Radnic
https://www.instagram.com/singlecycled/
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://soundcloud.com/sumovi-protiv-valova 00385(0)915225162
On Saturday, November 29, 2025 at 04:40:48 PM GMT+1, Miller Puckette via Pd-list pd-list@lists.iem.at wrote:
Are you by any chance updating x before running the y calculation? If you do that, y will be calculated using the updated x and not the correct (original) one.
cheers Miller
On 11/29/25 6:49 AM, Hrvoje Radnic via Pd-list wrote:
Dear group,
I cannot figure out why the calculations inside [expr (x*cos(theta))-(y*sin(theta)); (x*sin(theta))+(y*cos(theta))] gives me wrong results.
The above mentioned formula for rotation is correct. I initialize the values through [value] object before preforming computation. The initial values are: x=1, y=0, theta=1/2pi. I expect the new x and new y to be (0,1) respectively after the rotation. But, for some reason, I get (-1,1). I checked the help files for [value] and [expr] and it looks like I am doing everything right. Anyone have an idea where's the mistake? Thank you! Hrvoje Radnic
https://urldefense.com/v3/__https://www.instagram.com/singlecycled/__;!!Mih3...
https://urldefense.com/v3/__https://pdvrecords.bandcamp.com/album/umovi-prot...
https://urldefense.com/v3/__https://soundcloud.com/sumovi-protiv-valova__;!!...
00385(0)915225162
pd-list@lists.iem.at - the Pure Data mailinglist
https://urldefense.com/v3/__https://lists.iem.at/hyperkitty/list/pd-list@lis...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://urldefense.com/v3/__https://lists.iem.at/__;!!Mih3wA!DfrXKhsjBltnmdI...
pd-list@lists.iem.at - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/HB5NXTYHAO...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
pd-list@lists.iem.at - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/Y2BHE7H533...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
could it be some confusion between x, y from [value x]. [value y] and the x and y used for input/last output (e.g. in fexpr~)?
does it work if you rename x, y to a, b?
On 14/12/2025 14:59, Antoine Rousseau wrote:
it works here, double check your order of operations:
#N canvas 131 195 450 300 12; #X msg 119 70 1 0 1.5708; #X floatatom 119 140 15 0 0 0 - - - 0; #X floatatom 361 137 5 0 0 0 - - - 0; #X obj 119 95 expr ($f1*cos($f3))-($f2*sin($f3)) ; ($f1*sin($f3))+($f2*cos($f3)); #X connect 0 0 3 0; #X connect 3 0 1 0; #X connect 3 1 2 0;
Antoine
Le dim. 14 déc. 2025 à 11:56, Hrvoje Radnic via Pd-list pd-list@lists.iem.at a écrit :
Thank you Miller for your suggestion. I don't think that's the case, I checked the order of operations with [print] and everything looks like it should. I even made the signal version of the whole [expr] computation in order to bypass the possibility of wrong order and the result is repeated there as well. So, it must be math inside [expr], but I really struggle to find any clue. Hrvoje Radnic https://www.instagram.com/singlecycled/ https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://soundcloud.com/sumovi-protiv-valova 00385(0)915225162 On Saturday, November 29, 2025 at 04:40:48 PM GMT+1, Miller Puckette via Pd-list <pd-list@lists.iem.at> wrote: Are you by any chance updating x before running the y calculation? If you do that, y will be calculated using the updated x and not the correct (original) one. cheers Miller On 11/29/25 6:49 AM, Hrvoje Radnic via Pd-list wrote: > Dear group, > > I cannot figure out why the calculations inside > [expr (x*cos(theta))-(y*sin(theta)); > (x*sin(theta))+(y*cos(theta))] gives me wrong results. > > The above mentioned formula for rotation is correct. I initialize the > values through [value] object before preforming computation. The > initial values are: x=1, y=0, theta=1/2pi. I expect the new x and new > y to be (0,1) respectively after the rotation. But, for some reason, I > get (-1,1). I checked the help files for [value] and [expr] and it > looks like I am doing everything right. > Anyone have an idea where's the mistake? > Thank you! > Hrvoje Radnic > > https://www.instagram.com/singlecycled/ > <https://urldefense.com/v3/__https://www.instagram.com/singlecycled/__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhNcNbhmE$> > > https://pdvrecords.bandcamp.com/album/umovi-protiv-valova > <https://urldefense.com/v3/__https://pdvrecords.bandcamp.com/album/umovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhEqqX9g8$> > https://soundcloud.com/sumovi-protiv-valova > <https://urldefense.com/v3/__https://soundcloud.com/sumovi-protiv-valova__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhLRt9iry$> > 00385(0)915225162 > > --- > pd-list@lists.iem.at - the Pure Data mailinglist > https://urldefense.com/v3/__https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/FVTCX5A323GUEEZXZWNLAY5YFNK7GP74/__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhNKdlmmG$ > > To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list > UNSUBSCRIBE and account-management -> https://urldefense.com/v3/__https://lists.iem.at/__;!!Mih3wA!DfrXKhsjBltnmdIUutLHu6UcsuMDJK4Q2d1t_PgsPezZ7FFjjwd46jjfXesqm2Rx6ggHKPDjhGLejGa2$ --- pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/HB5NXTYHAOSMVFG7BAWDEA62HF5W4KXG/ To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/ --- pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/Y2BHE7H533G7SK7H24TZ5HXA6KBKLTQX/ To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/AQ76J366EN...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
works with [value]s too:
#N canvas 145 73 450 258 12; #X obj 26 132 expr (x*cos(theta))-(y*sin(theta)) ; (x*sin(theta))+(y*cos(theta)); #X msg 26 24 1 0 1.5708; #X obj 26 49 t b a; #X obj 58 74 unpack f f f; #X obj 139 98 v theta; #X obj 98 100 v y; #X obj 58 98 v x; #X floatatom 26 172 9 0 0 0 - - - 0; #X floatatom 268 171 10 0 0 0 - - - 0; #X connect 0 0 7 0; #X connect 0 1 8 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 2 1 3 0; #X connect 3 0 6 0; #X connect 3 1 5 0; #X connect 3 2 4 0;
Le dim. 14 déc. 2025 à 15:07, Claude Heiland-Allen claude@mathr.co.uk a écrit :
could it be some confusion between x, y from [value x]. [value y] and the x and y used for input/last output (e.g. in fexpr~)?
does it work if you rename x, y to a, b?
Thank you Antoine for help!It works, but only once. If I feed the results from [expr] into [v x] and [v y], it starts to act like in my original post. Maybe I completely missed the purpose of [value] object. My idea was to set only the initial values and then advance with 90 degrees of rotation from updated x and y values with every bang the [expr] object receives. Hrvoje Radnic https://www.instagram.com/singlecycled/
https://pdvrecords.bandcamp.com/album/umovi-protiv-valova https://soundcloud.com/sumovi-protiv-valova 00385(0)915225162
On Sunday, December 14, 2025 at 04:53:27 PM GMT+1, Antoine Rousseau <antoine@metalu.net> wrote:
works with [value]s too: #N canvas 145 73 450 258 12; #X obj 26 132 expr (x*cos(theta))-(y*sin(theta)) ; (x*sin(theta))+(y*cos(theta)); #X msg 26 24 1 0 1.5708; #X obj 26 49 t b a; #X obj 58 74 unpack f f f; #X obj 139 98 v theta; #X obj 98 100 v y; #X obj 58 98 v x; #X floatatom 26 172 9 0 0 0 - - - 0; #X floatatom 268 171 10 0 0 0 - - - 0; #X connect 0 0 7 0; #X connect 0 1 8 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 2 1 3 0; #X connect 3 0 6 0; #X connect 3 1 5 0; #X connect 3 2 4 0; Le dim. 14 déc. 2025 à 15:07, Claude Heiland-Allen claude@mathr.co.uk a écrit :
could it be some confusion between x, y from [value x]. [value y] and the x and y used for input/last output (e.g. in fexpr~)?
does it work if you rename x, y to a, b?
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7STICENY5L...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
Ok, you're right! But it's not a bug. Your problem comes from the fact [expr] first computes the expression corresponding to the right-most outlet (the 'y' value in your case), which (if done 'naively') immediately updates the [value y]. Then it computes the left-most outlet expression (the 'x' value); at this point, the formula "(x*cos(theta))-(y*sin(theta))" uses the previous 'x' value but the UPDATED 'y' value. Hence the "wrong" result.
So what you need is to ensure that [value y] is NOT updated before the 'x' value is computed. One solution is to store the 2nd outlet output into the right outlet of a [f], that you bang when the first outlet fires. Another is to use a [pack f f], which is [unpack]ed only when the 'x' value comes to its first inlet. This solution easily supports more than 2 outlets.
[expr compute_x(x, y); compute_y(x, y)] | | [pack f f ] | [unpack f f] | | [v x] [v y]
In pd:
#N canvas 145 73 450 335 12; #X obj 26 176 expr (x*cos(theta))-(y*sin(theta)) ; (x*sin(theta))+(y*cos(theta)); #X msg 24 38 1 0 1.5708; #X obj 24 64 unpack f f f; #X obj 105 88 v theta; #X obj 64 90 v y; #X obj 24 88 v x; #X floatatom 26 299 9 0 0 0 - - - 0; #X floatatom 93 299 10 0 0 0 - - - 0; #X obj 103 271 v y; #X obj 37 271 v x; #X obj 26 149 bng 20 250 50 0 empty empty empty 0 -10 0 12 #fcfcfc #000000 #000000; #X obj 26 217 pack f f, f 35; #X obj 26 242 unpack f f; #X text 23 16 1: init; #X text 24 127 2: iterate; #X connect 0 0 11 0; #X connect 0 1 11 1; #X connect 1 0 2 0; #X connect 2 0 5 0; #X connect 2 1 4 0; #X connect 2 2 3 0; #X connect 10 0 0 0; #X connect 11 0 12 0; #X connect 12 0 6 0; #X connect 12 0 9 0; #X connect 12 1 7 0; #X connect 12 1 8 0;
Antoine
Le dim. 28 déc. 2025 à 16:25, Hrvoje Radnic hrvojeradnic@yahoo.com a écrit :
Thank you Antoine for help! It works, but only once. If I feed the results from [expr] into [v x] and [v y], it starts to act like in my original post. Maybe I completely missed the purpose of [value] object. My idea was to set only the initial values and then advance with 90 degrees of rotation from updated x and y values with every bang the [expr] object receives.