Dear list,
how would you calculate with an expression this formula:
arctg(y/x)
looks like tan, sin, cos cannot be in the expression, does it mean I have to brake it into parts?
Best,
Popesz
On 2/2/20 8:18 PM, Csaba Láng wrote:
Dear list,
how would you calculate with an expression this formula:
arctg(y/x)
the canonical object for this is [atan2].
since you asked about "expressions", use:
[expr atan($f2/$f1)]
looks like tan, sin, cos cannot be in the expression, does it mean I have to brake it into parts?
what do you see that i don't when creating [expr tan($f1); sin($f1); cos($f1)] ?
fgmdsar IOhannes
Hello,
You can look at : http://yadegari.org/expr/expr.html ++
Jack
Le 02/02/2020 à 20:18, Csaba Láng a écrit :
Dear list,
how would you calculate with an expression this formula:
arctg(y/x)
looks like tan, sin, cos cannot be in the expression, does it mean I have to brake it into parts?
Best,
Popesz
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
thank you gentlemen, this is what I needed. never figured out that atan is arctn.
On Sun, Feb 2, 2020 at 8:49 PM Jack jack@rybn.org wrote:
Hello,
You can look at : http://yadegari.org/expr/expr.html ++
Jack
Le 02/02/2020 à 20:18, Csaba Láng a écrit :
Dear list,
how would you calculate with an expression this formula:
arctg(y/x)
looks like tan, sin, cos cannot be in the expression, does it mean I have to brake it into parts?
Best,
Popesz
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Am 2. Februar 2020 20:52:14 MEZ schrieb "Csaba Láng" langcsaba@gmail.com:
thank you gentlemen, this is what I needed. never figured out that atan is arctn.
in general, you might prefer atan2
over atan
, as this allows for all four quadrants.
[expr]
has both variants.
mfg.hft.fsl IOhannes
looks like [atan2] works for me better than the expression you gave. indeed i need all 4 quarters, what the expression does not indicate.
On Sun, Feb 2, 2020 at 9:01 PM IOhannes m zmölnig zmoelnig@iem.at wrote:
Am 2. Februar 2020 20:52:14 MEZ schrieb "Csaba Láng" <langcsaba@gmail.com
: thank you gentlemen, this is what I needed. never figured out that atan is arctn.
in general, you might prefer
atan2
overatan
, as this allows for all four quadrants.
[expr]
has both variants.mfg.hft.fsl IOhannes
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 2/2/20 9:59 PM, Csaba Láng wrote:
looks like [atan2] works for me better than the expression you gave. indeed i need all 4 quarters, what the expression does not indicate.
how should it?
anyhow, you *can* use [expr atan2($f2,$f1)] which does the same (though of course, if you only want the arctangens, [atan2] is simpler and faster)
gfadsrm IOhannes
On Sun, Feb 2, 2020 at 9:01 PM IOhannes m zmölnig zmoelnig@iem.at wrote:
Am 2. Februar 2020 20:52:14 MEZ schrieb "Csaba Láng" <langcsaba@gmail.com
: thank you gentlemen, this is what I needed. never figured out that atan is arctn.
in general, you might prefer
atan2
overatan
, as this allows for all four quadrants.
[expr]
has both variants.mfg.hft.fsl IOhannes
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Em dom., 2 de fev. de 2020 às 11:49, Jack jack@rybn.org escreveu:
Hello,
You can look at : http://yadegari.org/expr/expr.html
best look at the help file of [expr], it is much more up to date than that link (unless you're not using the latest vanilla)
Back to the difference of Iohannes' suggestions, looks like [expr atan...] gives results only from -90 to 90 degrees, [atan2] gives from -180 to 180. And the atan2 is 90 degree rotated: atan2 results 0 degree on (1;0) while the expression gives 0 degrees on (0;1) and (0;-1).
On Mon, Feb 3, 2020 at 1:28 AM Alexandre Torres Porres porres@gmail.com wrote:
Em dom., 2 de fev. de 2020 às 11:49, Jack jack@rybn.org escreveu:
Hello,
You can look at : http://yadegari.org/expr/expr.html
best look at the help file of [expr], it is much more up to date than that link (unless you're not using the latest vanilla) _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 2/3/20 10:28 AM, Csaba Láng wrote:
Back to the difference of Iohannes' suggestions, looks like [expr atan...] gives results only from -90 to 90 degrees, [atan2] gives from -180 to 180.
yes, quite obviously. this is why atan2 was introduced (in various programming languages; Pd is only following other implementations, like C).
the problem being that you cannot distinguish -1/-1 from 1/1 (both will yield the same result; however, for the atan the signs of the numerator & denominator determine the quadrant of the output.
And the atan2 is 90 degree rotated: atan2 results 0 degree on (1;0) while the expression gives 0 degrees on (0;1) and (0;-1).
dunno what you mean.
[atan2] and [expr atan2($f1,$f2)] give exactly the same results.
(of course if you use [expr atan2($f2,$f1)] you reverse the arguments; but that's what you ask for...)
gfmdsar IOhannes