Joe Riel

9660 Reputation

23 Badges

20 years, 3 days

MaplePrimes Activity


These are replies submitted by Joe Riel

A few caveats with that approach. First, monomials must be handled separately, otherwise bad things will happen (consider the monomials 1, x^2, and a*x^2, each exhibits a different wrong result). Second, using degree requires collecting, otherwise it can return FAIL. Finally, and this isn't a bug here but just a general warning, using mod can occasionally lead to errors if we assume the result must be nonnegative and mod has been replaced with mods (rather than modp); mod is an environmental variable. Using modp directly avoids that possibility. However, testing for the result to be zero, as you did, is safe. Thus, don't do something like j mod 3 = 2. Use either (j-2) mod 3 = 0 or modp(j,3) = 2.
See my second post, the one titled "Mathematical approach". Thanks for suggesting it; it does seem the simplest way to go.
See my second post, the one titled "Mathematical approach". Thanks for suggesting it; it does seem the simplest way to go.
My mistake(s). Instead of cutting and pasting from your examples I mistyped them, left the braces off the subsop (in f) and thought that it was supposed to be returning the constant term. Naturally it returned NULL for a constant poly...
There is a flaw in that technique; if the polynomial is the constant term it returns NULL rather than zero. Than can be corrected with an explicit test, `if`(result=NULL,0,result)
I had edited my original post (a few times), so you probably missed the subs method while responding. I saw your original post, with the mention of subs (after I had already edited my blog, else I'd have given you credit) while responding to it, but you must have elided the text during my response. My real problem was extracting the coefficients of a multivariate polynomial, not including the constant term. My current technique is
const := subs(seq(v=0,v=avars), expr);
coefs := {coeffs}(expr-const, avars);
where avars is a list of variables and expr is the polynomial (collected with respect to avars). I believe that that is solid; expr has been previously checked with type(expr,polynom(anything,avars)). At one point I had naively done
coefs := {coeffs}(expr,avars) minus {const};
before realizing that that doesn't work with, say,
  k*x + k
where a desired coefficient matches the constant term.
It does work, thanks for bringing it to my attention. My first thought was, there should be a link to it on the ?coeff help page. There already is; I didn't follow it. coeftayl is rather expensive, it uses diff and limit (when required). For simple polynomials (no negative degrees) subs is probably the way to go.
That's the trick for doing the simplification. Thanks for pointing this out.
That's the trick for doing the simplification. Thanks for pointing this out.
plot([seq]([x,5*x+1],x=0..1,0.1));
plot([seq]([x,5*x+1],x=0..1,0.1));
If you're an avid road cyclist, bring your bike. The south grade is a 7 mile climb (12 miles from Valley Center) at 7-8% with lots of switchbacks (essentially an Hors Category climb, for Tour de France followers). The observatory is a few more miles from there. The descent of the south grade is a blast, the only concern is the motorcycle cafe racers, however, if you are a good descender you won't be passed by more than a few. Just don't get stuck behind a bus.
Previously (a couple months ago) I had looked into it and it didn't appear supported, but I may have been confused. The FAQ you mentioned does indicate that my setup should be sufficient. I went to the WebEx site and tried the "test your system" link (or something like that). It stated that my OS (linux Debian) was of type unknown and implied, therefore, that it didn't meet the minimal requirements. However, I signed onto the demo at that site, it appeared to work properly. Thanks, Tom, for pointing this out.
Meaning you'll need a Windows (or maybe Mac) machine. That is, WebEx doesn't currently work on linux, alas.
To handle your condition 2.2, do
adds := proc(a,b)
local j;
    add(a[j]*`if`(b[j,1]>=b[j,2]
                  ,b[j,1]-b[j,2]+1
                  ,0)
        ,j=1..nops(a));
end proc:
First 185 186 187 188 189 190 191 Last Page 187 of 195