Art Kalb

252 Reputation

12 Badges

17 years, 264 days

MaplePrimes Activity


These are replies submitted by Art Kalb

@tomleslie 
 
Thanks for the reply.

I definitely intend it to only match for type algebraic.

type(x,algebraic) returns true

I get a valid pattern match for an arbitrary function "f"

example.mw

 

My expectation is that if x is not algebraic that I would get a false match.

 

 

 

 

@Carl Love Thanks for the reply. I had seen the wrightomega function, but I'm not sure how this helps me. Maple will not solve for the wrightomega function, so I am stuck trying to get my answer onto the correct branch.

 

@Carl Love . Thanks Carl. The result looks good.

I did some further clean-up, borrowing from your basic idea. I eliminated the multiple patterns for alpha. Slightly different. I think equivalent?

Regards.

alias(alpha = RootOf(x^4+x+1))

alpha

(1)

z := alpha^3*a[3]+alpha^2*a[2]+alpha*a[1]+a[0]

a[3]*alpha^3+a[2]*alpha^2+a[1]*alpha+a[0]

(2)

mod2simp := proc (x) options operator, arrow; `mod`(thaw(subsindets[2](subsindets(x, {identical(alpha)}, freeze), Not(identical(freeze(alpha)))^integer, 1, op)), 2) end proc;

proc (x) options operator, arrow; `mod`(thaw(subsindets[2](subsindets(x, {identical(alpha)}, freeze), Not(identical(freeze(alpha)))^integer, 1, op)), 2) end proc

(3)

z2 := collect(`mod`(Expand(z^2), 2), alpha):

z3 := collect(`mod`(Expand(z^3), 2), alpha):

``

mod2simp(z2)

a[3]*alpha^3+(a[1]+a[3])*alpha^2+a[2]*alpha+a[0]+a[2]

(4)

mod2simp(z3)

(a[1]*a[3]+a[2]*a[3]+a[1]+a[2]+a[3])*alpha^3+(a[0]*a[1]+a[0]*a[2]+a[0]*a[3]+a[1]*a[2]+a[1]*a[3]+a[2]*a[3]+a[2])*alpha^2+(a[0]*a[1]+a[0]*a[2]+a[2]*a[3]+a[3])*alpha+a[0]+a[0]*a[2]+a[1]*a[2]+a[1]*a[3]

(5)

``


Download Polynomial_Mod_2.mw

@Carl Love : Thanks for the response. I thought you had it, but realized the alpha's are also being reduced.

 

@Carl Love : Thanks. It does the trick. Took me a couple minutes to decipher what it was doing - interesting.

 

I'll leave the thread open a bit to see if someone comes up with something slicker.

 

Thanks again.

The following does work:

`erf/InverseErf`(y)

               y

 

 

The following does work:

`erf/InverseErf`(y)

               y

 

 

@Art Kalb There were no semicolons after the function calls.

@Art Kalb There were no semicolons after the function calls.

@Carl Love I expect it to just return the argument to the inner call.

Here is what I am getting:

evalf(InverseErf(y));
                               y
erf(InverseErf(y));
                       erf(InverseErf(y))
InverseErf(erf(y));
                       InverseErf(erf(y))


Note that evalf returns y, the other two functions do not. I would expect all of them to return y.

 

I was basing my code on the page "evalf,details"

@Carl Love I expect it to just return the argument to the inner call.

Here is what I am getting:

evalf(InverseErf(y));
                               y
erf(InverseErf(y));
                       erf(InverseErf(y))
InverseErf(erf(y));
                       InverseErf(erf(y))


Note that evalf returns y, the other two functions do not. I would expect all of them to return y.

 

I was basing my code on the page "evalf,details"

Thanks for the input. I am trying to write a generic procedure so it would be hard to provide an initial guess. I would also like to maintain the domain checking.

I agree fsolve may not be the best solution. I'm pretty sure it was you that wrote an article somewhere on Mapleprimes about erf? Have you implemented anything that chooses the appropriate approximation for each region? I did some research and there does appear to be some decent approximations (accurate out to 10e-19 or so).

I wasn't sure what the "use any fct instead" meant? Could you please clarify?

 

 

Thanks for the input. I am trying to write a generic procedure so it would be hard to provide an initial guess. I would also like to maintain the domain checking.

I agree fsolve may not be the best solution. I'm pretty sure it was you that wrote an article somewhere on Mapleprimes about erf? Have you implemented anything that chooses the appropriate approximation for each region? I did some research and there does appear to be some decent approximations (accurate out to 10e-19 or so).

I wasn't sure what the "use any fct instead" meant? Could you please clarify?

 

 

@Carl Love : Thanks again for taking the time. I tried your suggestion and it didn't make any difference. I have simplified the problem to the code below. The evalf function works. The other two don't. I don't see any obvious difference.

InverseErf:=module()
    option package;
    export ModuleApply;
    local ModuleLoad;
    ModuleApply := proc(x)
        local y;
        if type(x,complex(float)) then
            fsolve(x=erf(y),y,fulldigits);
        else
            'InverseErf'(x);
        end if:
    end proc:

    ModuleLoad := proc()
        global `evalf/InverseErf`;
        global `erf/InverseErf`;
        global `InverseErf/erf`;
        `evalf/InverseErf` := proc(x)
            return x;
        end proc:
        `erf/InverseErf` := proc(x)
            return x;
        end proc:
        `InverseErf/erf` := proc(x)
            return x;
        end proc:
    end proc:

    ModuleLoad();

end module:

@Carl Love : Thanks again for taking the time. I tried your suggestion and it didn't make any difference. I have simplified the problem to the code below. The evalf function works. The other two don't. I don't see any obvious difference.

InverseErf:=module()
    option package;
    export ModuleApply;
    local ModuleLoad;
    ModuleApply := proc(x)
        local y;
        if type(x,complex(float)) then
            fsolve(x=erf(y),y,fulldigits);
        else
            'InverseErf'(x);
        end if:
    end proc:

    ModuleLoad := proc()
        global `evalf/InverseErf`;
        global `erf/InverseErf`;
        global `InverseErf/erf`;
        `evalf/InverseErf` := proc(x)
            return x;
        end proc:
        `erf/InverseErf` := proc(x)
            return x;
        end proc:
        `InverseErf/erf` := proc(x)
            return x;
        end proc:
    end proc:

    ModuleLoad();

end module:

1 2 3 4 5 6 7 Page 3 of 7