Art Kalb

187 Reputation

11 Badges

12 years, 274 days

MaplePrimes Activity


These are replies submitted by Art Kalb

@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:

Thanks for replying.

What you recommend generates errors.

A pair of uneval quotes on the global statements generates an "unexpected single forward quote" error.

The uneval quotes on the assignment generates "invalid left hand side of assignment."

 

My original code follows the proto-type shown in the help pages. It also works for the evalf function. Just not for the other two.

 

Any other suggestions?

Thanks for replying.

What you recommend generates errors.

A pair of uneval quotes on the global statements generates an "unexpected single forward quote" error.

The uneval quotes on the assignment generates "invalid left hand side of assignment."

 

My original code follows the proto-type shown in the help pages. It also works for the evalf function. Just not for the other two.

 

Any other suggestions?

And the answer to that would be?

And the answer to that would be?

Hi,

 

Yes. Sorry I already knew that part. Didn't think to mention it.

Thanks for looking at the question.

 

Regards.

Hi,

 

Yes. Sorry I already knew that part. Didn't think to mention it.

Thanks for looking at the question.

 

Regards.

I opened a new document and now it seems to work all the time.

Don't know what happened...

 

Thanks.

1 2 3 4 5 6 Page 2 of 6