Art Kalb

197 Reputation

11 Badges

15 years, 140 days

MaplePrimes Activity


These are replies submitted by Art Kalb

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.

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

Don't know what happened...

 

Thanks.

Hi,

 

I should have mentioned that I know

is imaginary.

 

Regards,

 

Art

@Alejandro Jakubi I am wondering why you think having sqrt as a module is better? My understanding of a module is that it is a collection of bindings with its own environment. It is not apparent to me why making a module with sqrt is better than binding it into the global environment?

Hi,

 

Thanks for the response. The question I was posing was how to format when using the Export command. If you look in your example, the numbers are formatted as .xxxxxxxxxxExx. I was looking for x.xxExx (or more generically, how to control the formatting).

 

Regards.

Hi,

 

Thanks for the response. The question I was posing was how to format when using the Export command. If you look in your example, the numbers are formatted as .xxxxxxxxxxExx. I was looking for x.xxExx (or more generically, how to control the formatting).

 

Regards.

1 2 3 4 5 6 Page 3 of 6