## 237 Reputation

16 years, 198 days

## Looks good. Further clean-up....

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

 (1)

 (2)

 (3)

 (4)

 (5)

## Whoops. Not quite....

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

## Thanks. Does the trick....

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

## This does work....

The following does work:

`erf/InverseErf`(y)

y

## This does work....

The following does work:

`erf/InverseErf`(y)

y

## followup...

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

## followup...

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

## symbols and uneval quotes...

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

## symbols and uneval quotes...

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

## All good suggestions...

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?

## All good suggestions...

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?

## symbol and uneval quotes...

@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;
ModuleApply := proc(x)
local y;
if type(x,complex(float)) then
fsolve(x=erf(y),y,fulldigits);
else
'InverseErf'(x);
end if:
end 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:

end module:

## symbol and uneval quotes...

@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;
ModuleApply := proc(x)
local y;
if type(x,complex(float)) then
fsolve(x=erf(y),y,fulldigits);
else
'InverseErf'(x);
end if:
end 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:

end module:

## Generates errors...

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?

## Generates errors...

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?

 1 2 3 4 5 6 7 Page 3 of 7
﻿