Axel Vogt

5821 Reputation

20 Badges

20 years, 225 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are replies submitted by Axel Vogt

I have not cared for 'rational' (one can), but this would do (digging in old files around the Maple usenet group ...):
ExponentsToFloats:=proc(expr)
local simplePower;

simplePower:=proc(expr) 
# convert x^a to x^(evalf(a))
# except division and pure sqrt
local x,a;

Digits:=Digits+3;

# validate input
if op(0,expr) = `^` then
  x:= op(1,expr);
  a:= op(2,expr);
else
  return(expr);
end if;

# do not change for division and sqrt 
if   ( a = -1 ) then
  return ( 1/x );
elif ( a = 1/2 ) then
  return ( sqrt(x) );
elif ( a = -1/2 ) then
  return ( 1/sqrt(x) );
end if;

return x^evalf(a);
end proc;

return evalindets( q, '`^`', f -> simplePower(f) );
end proc;

Examples:
q:= (x^(41/39))^(I*(3/7)), ExponentsToFloats(q) gives
(x^1.051282051282)^(.4285714286*I)

q:=hypergeom([Pi,b^(99/100)],[c],exp(1)/sqrt(x^(201/199)/2)) gives
hypergeom([Pi, b^.9900000000000],[c],exp(1)*2^(1/2)/(x^1.010050251256)^(1/2));
I have not cared for 'rational' (one can), but this would do (digging in old files around the Maple usenet group ...):
ExponentsToFloats:=proc(expr)
local simplePower;

simplePower:=proc(expr) 
# convert x^a to x^(evalf(a))
# except division and pure sqrt
local x,a;

Digits:=Digits+3;

# validate input
if op(0,expr) = `^` then
  x:= op(1,expr);
  a:= op(2,expr);
else
  return(expr);
end if;

# do not change for division and sqrt 
if   ( a = -1 ) then
  return ( 1/x );
elif ( a = 1/2 ) then
  return ( sqrt(x) );
elif ( a = -1/2 ) then
  return ( 1/sqrt(x) );
end if;

return x^evalf(a);
end proc;

return evalindets( q, '`^`', f -> simplePower(f) );
end proc;

Examples:
q:= (x^(41/39))^(I*(3/7)), ExponentsToFloats(q) gives
(x^1.051282051282)^(.4285714286*I)

q:=hypergeom([Pi,b^(99/100)],[c],exp(1)/sqrt(x^(201/199)/2)) gives
hypergeom([Pi, b^.9900000000000],[c],exp(1)*2^(1/2)/(x^1.010050251256)^(1/2));
I like Joe Riel's approach - how does one modify you solution to get a tab spacing of 2 (which i prefer)?
no, not to the general question around the Geddes method (still waiting that Fred finds time for some answers), but for your original task as this board seems to allow no uploads within threads i put it here, 36Kb: http://www.axelvogt.de/maplekram/integral_for_Bayesian_short_example.zip PS: i can no longer find the way to get informed via mail if someone answers to a specific thread - where is?
no, not to the general question around the Geddes method (still waiting that Fred finds time for some answers), but for your original task as this board seems to allow no uploads within threads i put it here, 36Kb: http://www.axelvogt.de/maplekram/integral_for_Bayesian_short_example.zip PS: i can no longer find the way to get informed via mail if someone answers to a specific thread - where is?
Hi Fred, Thx, I try to follow your sketch ... symmetric ... Hm - may I ask some questions? Why 'splitting'? A Taylor series already does it, no? What is the practical advantage of the more general approach? Then: I did not quite get the algo for splitting in Carvajal's paper, page 11. It depends on the splitting points ... and one has to have the supremums norm (which might difficult to get). How would you do that for the example, ie sqrt( symmetric polynom ), which is still symmetric (it has only degree 2)?
Hi Fred, Thx, I try to follow your sketch ... symmetric ... Hm - may I ask some questions? Why 'splitting'? A Taylor series already does it, no? What is the practical advantage of the more general approach? Then: I did not quite get the algo for splitting in Carvajal's paper, page 11. It depends on the splitting points ... and one has to have the supremums norm (which might difficult to get). How would you do that for the example, ie sqrt( symmetric polynom ), which is still symmetric (it has only degree 2)?
grrrr ... this idiotic forum software ... I hate it! Here is the rest: using assuming (0 LT a,r LT 1, 0 LT b,s LT 1) So in the transformed problem one can replace infinity by maxNum, now living in a large, but compact rectangle. There are 1/quadratic terms in the sqrt, which still cause trouble for the numerics. Again split the rectangle in 4 parts (but here i got no analytical solution) according to sqrt(maxNum). Or use the hybrid power of Maple for the 3 'ugly' parts. Now it should be possible to evaluate the thing ... but I lost patients to carry it out, for some bad parameters one still would have to work a bit. Certainly not very elegant ... And one has to care for the error estimates ...
grrrr ... this idiotic forum software ... I hate it! Here is the rest: using assuming (0 LT a,r LT 1, 0 LT b,s LT 1) So in the transformed problem one can replace infinity by maxNum, now living in a large, but compact rectangle. There are 1/quadratic terms in the sqrt, which still cause trouble for the numerics. Again split the rectangle in 4 parts (but here i got no analytical solution) according to sqrt(maxNum). Or use the hybrid power of Maple for the 3 'ugly' parts. Now it should be possible to evaluate the thing ... but I lost patients to carry it out, for some bad parameters one still would have to work a bit. Certainly not very elegant ... And one has to care for the error estimates ...
Still i do not know, whether you mean dim=2 only ... Here some more ideas for the numerics: 'Int(Int(1/eta^(s)*S(xi,eta)^(1/2)/xi^(r),xi = 0 .. a),eta = 0 .. b)'; IntegrationTools[Change](%, {xi=1/(x-a), eta=1/(y-b)},[x,y]): sends the 'problems' to infinity and writes as c*Int(Int(K(x,y),x = (1+a^2)/a .. infinity),y = (1+b^2)/b .. infinity), K:= (x,y) -> S(-1/(-x+a),-1/(-y+b))^(1/2)*(y-b)^(s-2)*(x-a)^(r-2), a = bX^100, b = bY^1411, r = 99/100, s = 1410/1411, c = 1/141100. Now look at the expression under the sqrt: for large x or y one can ignore the a or b (at least for a numerical integrator), say beyond maxNum:=10^16 for usual hardware numerics, ie set them to 0. Beyond that there are 3 cases and in any case the integrals can be solved analytically (I have not cared for error estimates for this) using assuming (0<a, r<1, 0<b,s<1) So in the transformed problem one can replace infinity by maxNum, now living in a large, but compact rectangle. There are 1/quadratic terms in the sqrt, which still cause trouble for the numerics. Again split the rectangle in 4 parts (but here i got no analytical solution) according to sqrt(maxNum). Or use the hybrid power of Maple for the 3 'ugly' parts. Now it should be possible to evaluate the thing ... but I lost patients to carry it out, for some bad parameters one still would have to work a bit. Certainly not very elegant ... And one has to care for the error estimates ...
Still i do not know, whether you mean dim=2 only ... Here some more ideas for the numerics: 'Int(Int(1/eta^(s)*S(xi,eta)^(1/2)/xi^(r),xi = 0 .. a),eta = 0 .. b)'; IntegrationTools[Change](%, {xi=1/(x-a), eta=1/(y-b)},[x,y]): sends the 'problems' to infinity and writes as c*Int(Int(K(x,y),x = (1+a^2)/a .. infinity),y = (1+b^2)/b .. infinity), K:= (x,y) -> S(-1/(-x+a),-1/(-y+b))^(1/2)*(y-b)^(s-2)*(x-a)^(r-2), a = bX^100, b = bY^1411, r = 99/100, s = 1410/1411, c = 1/141100. Now look at the expression under the sqrt: for large x or y one can ignore the a or b (at least for a numerical integrator), say beyond maxNum:=10^16 for usual hardware numerics, ie set them to 0. Beyond that there are 3 cases and in any case the integrals can be solved analytically (I have not cared for error estimates for this) using assuming (0<a, r<1, 0<b,s<1) So in the transformed problem one can replace infinity by maxNum, now living in a large, but compact rectangle. There are 1/quadratic terms in the sqrt, which still cause trouble for the numerics. Again split the rectangle in 4 parts (but here i got no analytical solution) according to sqrt(maxNum). Or use the hybrid power of Maple for the 3 'ugly' parts. Now it should be possible to evaluate the thing ... but I lost patients to carry it out, for some bad parameters one still would have to work a bit. Certainly not very elegant ... And one has to care for the error estimates ...
for z between 0 and 1 take sqrt(z-1)*sqrt(z-2), so in both cases the input for sqrt is negative, while ...
for z between 0 and 1 take sqrt(z-1)*sqrt(z-2), so in both cases the input for sqrt is negative, while ...
Certainly there are several lecture notes available (for free) as well ... Not really introductory, but worth to look at: Heck, Introduction to Maple http://www.amazon.com/gp/product/0387002308/ref=sr_11_1/104-6979152-2772754?ie=UTF8 Richards, Advanced Mathematical Methods with Maple http://www.amazon.com/gp/product/0521779812/ref=pd_bxgy_img_b/104-6979152-2772754?ie=UTF8 and other suggestions can be found through http://www.maplesoft.com/books/
Certainly there are several lecture notes available (for free) as well ... Not really introductory, but worth to look at: Heck, Introduction to Maple http://www.amazon.com/gp/product/0387002308/ref=sr_11_1/104-6979152-2772754?ie=UTF8 Richards, Advanced Mathematical Methods with Maple http://www.amazon.com/gp/product/0521779812/ref=pd_bxgy_img_b/104-6979152-2772754?ie=UTF8 and other suggestions can be found through http://www.maplesoft.com/books/
First 199 200 201 202 203 204 205 Page 201 of 207