So I am just going thru the x_arithmetic.c math classes, and I found that while most of them do respond to a bang, about 1/3 of them have no method for bang. I would like to add a bang method to all these. I can't see any problem with doing this, anyone else? The new bang methods would act just like the other math object bang methods: the would output the last result.
These objects have a bang method:
+ - * / pow max min == != > < >= <= & && | || << >> % mod div
These do not:
clip sin cos tan atan atan2 sqrt log exp abs
Here's a patch to test this:
.hc
________________________________________________________________________ ____
"Computer science is no more related to the computer than astronomy is related to the telescope." -Edsger Dykstra
Zitiere Hans-Christoph Steiner hans@eds.org:
So I am just going thru the x_arithmetic.c math classes, and I found that while most of them do respond to a bang, about 1/3 of them have no
method for bang. I would like to add a bang method to all these. I can't see any problem with doing this, anyone else? The new bang methods would act just like the other math object bang methods: the would output the last result.
These objects have a bang method:
- / pow max min == != > < >= <= & && | || << >> % mod div
These do not:
clip sin cos tan atan atan2 sqrt log exp abs
well the difference is, that [+],... are binops while [sin],... are unary operations.
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
mfg.asdr. IOhannes
On Feb 7, 2006, at 4:32 PM, zmoelnig@iem.at wrote:
Zitiere Hans-Christoph Steiner hans@eds.org:
So I am just going thru the x_arithmetic.c math classes, and I found that while most of them do respond to a bang, about 1/3 of them have no
method for bang. I would like to add a bang method to all these. I can't see any problem with doing this, anyone else? The new bang methods would act just like the other math object bang methods: the would output the last result.
These objects have a bang method:
- / pow max min == != > < >= <= & && | || << >> % mod div
These do not:
clip sin cos tan atan atan2 sqrt log exp abs
well the difference is, that [+],... are binops while [sin],... are unary operations.
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
[clip] has 3 inlets and [atan2] has 2 inlets, so they are not unary operations. [clip] and [atan2] have their own classes, so that's easy.
It just seems consistent to have them all respond to a bang. Then you could get the last result easily without knowing when the last input was. But I can live for now with the unary operations ignoring bang. I do need [clip] to respond to a bang tho.
.hc
________________________________________________________________________ ____
¡El pueblo unido jamás será vencido!
On Tue, Feb 07, 2006 at 05:02:47PM -0500, Hans-Christoph Steiner wrote:
On Feb 7, 2006, at 4:32 PM, zmoelnig@iem.at wrote:
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
I do need [clip] to respond to a bang tho.
You could just put an [f] before it and bang that instead.
Best,
Chris.
------------------- chris@mccormick.cx http://mccormick.cx
On Feb 7, 2006, at 3:21 PM, Chris McCormick wrote:
On Tue, Feb 07, 2006 at 05:02:47PM -0500, Hans-Christoph Steiner wrote:
On Feb 7, 2006, at 4:32 PM, zmoelnig@iem.at wrote:
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
I do need [clip] to respond to a bang tho.
You could just put an [f] before it and bang that instead.
Or fix the bug ;)
http://sourceforge.net/tracker/index.php? func=detail&aid=1426736&group_id=55736&atid=478072
.hc
________________________________________________________________________ ____
"I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits." - Martin Luther King, Jr.
Hans-Christoph Steiner wrote:
On Feb 7, 2006, at 4:32 PM, zmoelnig@iem.at wrote:
since this is not needed it is not there for unops.
[clip] has 3 inlets and [atan2] has 2 inlets, so they are not unary operations. [clip] and [atan2] have their own classes, so that's easy.
It just seems consistent to have them all respond to a bang. Then you could get the last result easily without knowing when the last input was. But I can live for now with the unary operations ignoring bang. I do need [clip] to respond to a bang tho.
i did not mention [atan2] and [clip] in my arguing for good reasons...
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
as for getting the last result, why not use a [f] _after_ the object? this way you don't have to retrigger the "costy" operation.
mfg.asdr. IOhannes
.hc
¡El pueblo unido jamás será vencido!
On Feb 8, 2006, at 4:55 AM, IOhannes m zmoelnig wrote:
Hans-Christoph Steiner wrote:
On Feb 7, 2006, at 4:32 PM, zmoelnig@iem.at wrote:
since this is not needed it is not there for unops.
[clip] has 3 inlets and [atan2] has 2 inlets, so they are not unary operations. [clip] and [atan2] have their own classes, so that's easy.
It just seems consistent to have them all respond to a bang. Then you could get the last result easily without knowing when the last input was. But I can live for now with the unary operations ignoring bang. I do need [clip] to respond to a bang tho.
i did not mention [atan2] and [clip] in my arguing for good reasons...
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
I think that the interface should be consistent. Part of the strength of Pd is that converts math into an interactive exploration. You don't need to know anything about what atan2 is to hook up two sliders and see what it outputs.
In order to highlight this strength, the interface should be consistent whenever possible. When the interface is consistent, it makes it very straightforward to play around with all these objects. This something that Cyrille and I are trying to highlight with our mapping library. (externals/mapping)
as for getting the last result, why not use a [f] _after_ the object? this way you don't have to retrigger the "costy" operation.
Of course, its always possible to use a [float], but that won't recalculate when you change the number on the right inlet, i.e. this is not possible:
| [t b f] | | [atan2] |
Yet changing the number on the right-inlet changes the output.
.hc
mfg.asdr. IOhannes
.hc
__ ____
¡El pueblo unido jamás será vencido!
________________________________________________________________________ ____
"Looking at things from a more basic level, you can come up with a more direct solution... It may sound small in theory, but it in practice, it can change entire economies." - Amy Smith
On Wed, 8 Feb 2006, IOhannes m zmoelnig wrote:
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
man atan2
And then tell me how many args it takes in C. Then try it in Perl, Ruby, whatever. It's all the same. It's a two-input operator. So let it behave the way two-input operators do.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
Mathieu Bouchard wrote:
On Wed, 8 Feb 2006, IOhannes m zmoelnig wrote:
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
man atan2
And then tell me how many args it takes in C. Then try it in Perl, Ruby, whatever. It's all the same. It's a two-input operator. So let it behave the way two-input operators do.
i do not see how this contradicts my earlier mail. obviously, "atan2" takes 2 arguments, but they can be seen as parts (real/imag, nominator/denominator) of _one_ value ("numeric entitiy" or whatever the math name would be, i dunno) therefore i (still) think that "atan2" is kind of an unop, even though it needs 2 values, in any language. for various reasons (lack of imaginary numbers, history,...), atan2 is implemented as binop in most (if not all) languages.
a variable "ö" would be written in most prog.languages (except java, but who writes java...) with 2 letters, even though it is really a single letter. so what?
mfg.asdr. IOhannes
On Feb 13, 2006, at 7:13 AM, IOhannes m zmoelnig wrote:
Mathieu Bouchard wrote:
On Wed, 8 Feb 2006, IOhannes m zmoelnig wrote:
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
man atan2
And then tell me how many args it takes in C. Then try it in Perl, Ruby, whatever. It's all the same. It's a two-input operator. So let it behave the way two-input operators do.
i do not see how this contradicts my earlier mail. obviously, "atan2" takes 2 arguments, but they can be seen as parts (real/imag, nominator/denominator) of _one_ value ("numeric entitiy" or whatever the math name would be, i dunno)
therefore i (still) think that "atan2" is kind of an unop, even though it needs 2 values, in any language. for various reasons (lack of imaginary numbers, history,...), atan2 is implemented as binop in most (if not all) languages.
a variable "ö" would be written in most prog.languages (except java, but who writes java...) with 2 letters, even though it is really a single letter. so what?
Whatever the definition of atan2() or atan2 in math, [atan2] in Pd has two inlets. All multi-inlet math objects accept arguments and have a bang method except for [atan2]. This is not a math question, this is a computer science question. Pd should be a flexible system that makes as few assumptions about how people are going to use it. Pretending [atan2] has one inlet is violating this idea.
.hc
________________________________________________________________________ ____
"If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of everyone, and the receiver cannot dispossess himself of it." - Thomas Jefferson
On Feb 13, 2006, at 7:13 AM, IOhannes m zmoelnig wrote:
Mathieu Bouchard wrote:
On Wed, 8 Feb 2006, IOhannes m zmoelnig wrote:
i agree that [clip] should respond to bang. i am not that sure about [atan2]: personally i think that atan2 is a unop (the values are just there for get all 4 quadrants) and the 2nd inlet shouldn't be there at all.
man atan2
And then tell me how many args it takes in C. Then try it in Perl, Ruby, whatever. It's all the same. It's a two-input operator. So let it behave the way two-input operators do.
i do not see how this contradicts my earlier mail. obviously, "atan2" takes 2 arguments, but they can be seen as parts (real/imag, nominator/denominator) of _one_ value ("numeric entitiy" or whatever the math name would be, i dunno) therefore i (still) think that "atan2" is kind of an unop, even though it needs 2 values, in any language. for various reasons (lack of imaginary numbers, history,...), atan2 is implemented as binop in most (if not all) languages.
a variable "ö" would be written in most prog.languages (except java, but who writes java...) with 2 letters, even though it is really a single letter. so what?
I forgot to mention, what is the harm in having arguments and a bang method for [atan2]? A bit of extra memory use?
.hc
________________________________________________________________________ ____
If you are not part of the solution, you are part of the problem. - Eldridge Cleaver
On Mon, 13 Feb 2006, IOhannes m zmoelnig wrote:
i do not see how this contradicts my earlier mail. obviously, "atan2" takes 2 arguments, but they can be seen as parts (real/imag, nominator/denominator) of _one_ value
[+] is really unary, because it can be expressed using a single complex value z=a+bi:
a+b = Im((1+i)z) a-b = Re((1+i)z) a*b = Im(z/2) and so on
a variable "ö" would be written in most prog.languages (except java, but who writes java...) with 2 letters, even though it is really a single letter. so what?
one guy thinks that atan2 is unary but that +,-,* are binary. so what?
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Mon, 13 Feb 2006, Mathieu Bouchard wrote:
On Mon, 13 Feb 2006, IOhannes m zmoelnig wrote: [+] is really unary, because it can be expressed using a single complex value z=a+bi: a+b = Im((1+i)z) a-b = Re((1+i)z) a*b = Im(z/2) and so on
typo, a*b = Im(z*z/2)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
Mathieu Bouchard wrote:
one guy thinks that atan2 is unary but that +,-,* are binary. so what?
wow. it seems like i really made it into (another) flame war.
please, all of you, be assured that it is not my intent to change the behaviour of [atan2] to be a unary operator. (correction: my intent is to have a usable [atan2] which unfortunately it is not - due to the incompatibility in behaviour introduced with the change from 0.37 to 0.38: probably one of the worst things that ever happened to pd)
i only wanted to point out that i _can_ understand why [atan2] does not behave like an ordinary binop. obviously you dont.
my ability to understand does not imply that this ("understood") behaviour was intended by miller.
mfg.asdr. IOhannes
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
Mathieu Bouchard wrote:
one guy thinks that atan2 is unary but that +,-,* are binary. so what?
wow. it seems like i really made it into (another) flame war.
Instead of arguing about this, what about using expr to do atan2? It accepts a bang as shown in attached patch and is more readable anyway IMO.
Ciao
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
Instead of arguing about this, what about using expr to do atan2? It accepts a bang as shown in attached patch and is more readable anyway IMO.
Of course I meant, it's more readable as soon as you do some more calculations besides atan2, which everyone who needs to use atan2 probably needs to do anyway.
Ciao
Frank Barknecht wrote:
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
Mathieu Bouchard wrote:
one guy thinks that atan2 is unary but that +,-,* are binary. so what?
wow. it seems like i really made it into (another) flame war.
Instead of arguing about this, what about using expr to do atan2? It accepts a bang as shown in attached patch and is more readable anyway IMO.
You could do it the tcl way and use expr for every non-symbol operation. Would there be any difference in speed doing this?
Martin
On Tue, 14 Feb 2006, IOhannes m zmoelnig wrote:
i only wanted to point out that i _can_ understand why [atan2] does not behave like an ordinary binop. obviously you dont.
I can understand that there are people who want to make petty distinctions between things but I can't understand why any program I work with (or even work on) would fall in that trap. I don't want another BASIC or PERL.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
well the difference is, that [+],... are binops while [sin],... are unary operations.
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
I wonder what should be outout by a bang to a unary object. Right now the result of the last operation is not stored - a respective field would have to be added to the object. That's exactly what an [f] object does in a patch.
best greetings, Thomas
On Feb 8, 2006, at 5:20 AM, Thomas Grill wrote:
well the difference is, that [+],... are binops while [sin],... are unary operations.
the [bang(-method for binops is there for things like | [t b f] | | [+ ] |
since this is not needed it is not there for unops.
I wonder what should be outout by a bang to a unary object. Right now the result of the last operation is not stored - a respective field would have to be added to the object. That's exactly what an [f] object does in a patch.
Except that you can't force [atan2] to recalculate when you only update the number on the right inlet if the [float] stores the result. You'd have to do this:
| [t b f] / \ [float] | \ / [atan2] |
This is then the exact same as an [atan2] bang method, which all other 2-inlet math objects have.
.hc
________________________________________________________________________ ____
"I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits." - Martin Luther King, Jr.