| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| BTW the enclose function is the "left shoe" character in APLX. "Paul Houle" <asmguru@yahoo.com> wrote in message news:... > You need to enclose the left argument (scalarizing it) to distribute it > properly across all the right arguments. > > ({enclose}1 2) berp {each} 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 > > ...Paul > > "Peter Keller" <psilord@merlin.cs.wisc.edu> wrote in message > news:48f81aab$0$9898$80265adb@spool.cs.wisc.edu... >> Paul Houle <asmguru@yahoo.com> wrote: >>> Though you really want to re-write your function: >>> >>> r {gets} n binc i >>> r {gets} (x/{iota}n) {divide} (x/{iota}i) x x/{iota}n-i >>> >>> So you can use the result in subsequent calculation. >>> ...Paul >>> >>> "Paul Houle" <asmguru@yahoo.com> wrote in message >>> news:qwUJk.2652$hc1.2401@flpi150.ffdc.sbc.com... >>>> >>>> 5 binc {each} 0 1 2 3 4 5 >> >> Wow. I somehow had typed every other combination of {each} except the >> one you just did, which I tried and it worked just fine. That is pretty >> cool and makes me very happy since currying in this manner is a common >> idiom I wish to use. >> >> And I rewrote my functions about 5 minutes before you mentioned why as I >> had just puzzled out the VALUE ERROR I was getting in APLX. >> >> However, I have another function, berp, which is the berstein polynomial >> that takes the binomial coefficient parameters, plus a parameteric >> variable >> which represents a location on the bernstein polynomial curve. >> >> It looks like this: >> >> Z {gets} c berp u >> Z {gets} (c[2] binc c[1]) x (u*c[1]) x (1-u)*c[2]-c[1] >> >> And produces good answers: >> >>> 1 2 berp 0 >> 0 >> >>> 1 2 berp .5 >> .5 >> >>> 1 2 berp 1 >> 0 >> >> However, when I try the same trick: >> >> 1 2 berp {each} 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 >> >> It fails with a LENGTH ERROR on the marker on 1. >> >> Why doesn't {each} work in this context? Do I not have a vector on the >> left >> in the same manner that 5 binc {each} 0 1 2 3 4 5 did? >> >> Thank you. >> >> -pete > > |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.