Items tagged with evalf


Maple 15

eq:=1/2*x^(1/2) + 1/13*x^(1/3) + 1/26*x^(45/37);

The exponents are still fractions.  I want to have floating point exponents.

0.5*x^0.500000 + 0.07692307692*x^0.333333 + 0.03846153846*x^1.216216216

How do I do this?


Tom Dean

hi.please help me .why rule ''''evalf'''' dose not work properly?and I should copy the former answer in a another 'evalf' rule a gain??can I use only one rule 'evalf' instad twice useage??

this program attached blow.thanks alot


In the following code, the evalf prints -32.16... 

restart; S := 8;

sigma := 8/sqrt(2*Pi);

iprec := 151;

evalf(log[2](-(sum(log(round(2^iprec*exp(-j^2/(2*sigma^2)))/2^iprec*exp(-j^2/(2*sigma^2))))*round(2^iprec*exp(-j^2/(2*sigma^2)))/2^iprec, j = 0 .. 7))));


Change the last line to evalf[20](log[2](....)), and re-run *just that line*. It now prints -66.67...

Change the last line to evalf[200](log[2](...)) and re-run *just that line* again. It now prints -151.24... (I have strong evidence to support that the true value is near -151, so I believe this answer.)

Now remove the precision indicator from the command completely and re-run just the last line. It *still* prints -151.24...!


My two questions are: why do I need evalf[200] to get the first three digits of the answer to be correct? and why does setting the evalf precision and then removing it cause the previous precision to persist?

Below is a Maple ws describing the problem. I have some fixed values pr0 and pr1, and a four variations of a function "pdf". The problem is that when I use the function in a sum (either the "sum" function or the sigma notation), the result is different than if I write out the sum explicitly. It's very puzzling as to why they woudl be different in the first place, but even more strange is that the different versions have *different* deltas. Even version 3, with a delta of 10^-100 is too much for my application (moreover the delta gets larger when I sum over more terms).


In the worksheet below, I compare "sum(f(x),x=3..3)" to "f(3)". I expect this should always be identically 0, but that is not true for any of the four versions of my function. (The same is true for "Sum(f(x),x=3..3)".) However, "sum(f(3),x=3..3)" *is* (blessedly) identically "f(3)". What gives?


pr[0] := .499999999999999999999852096538403821434745813543502066245832554193147476551830440227306019620687012523264913799181385911651886999607086181640625:

pr[1] := .43394228095117646589504674154844928036961264935215813494922283329725383492977635163048065719014507668417797436877236805230495519936084747314453125:

pr0 := .499999999999999999999852096538403821434745813543502066245832554193147476551830440227306019620687012523264913799181385911651886999607086181640625:

pr1 := .43394228095117646589504674154844928036961264935215813494922283329725383492977635163048065719014507668417797436877236805230495519936084747314453125:

pdf1 := proc (x) local j, prob, y; prob := 1; y := x; for j from 0 to 1 do if `mod`(y, 2) = 1 then prob := prob*pr[j] else prob := prob*(1-pr[j]) end if; y := floor((1/2)*y) end do; return prob end proc:

Maple doesn't always like subscripted variables. Is that the problem?

pdf2 := proc (x) local prob, y; prob := 1; y := x; if `mod`(y, 2) = 1 then prob := prob*pr0 else prob := prob*(1-pr0) end if; y := floor((1/2)*y); if `mod`(y, 2) = 1 then prob := prob*pr1 else prob := prob*(1-pr1) end if; return prob end proc:

Maybe it's the binary expansion that's the issue

pdf3 := proc (arr) options operator, arrow; product(arr[2-j]*pr[j]+(1-arr[2-j])*(1-pr[j]), j = 0 .. 1) end proc:

No procedures, no arrays

pdf4 := proc (x) options operator, arrow; (`mod`(x, 2))*pr0+(1-(`mod`(x, 2)))*(1-pr0)+(`mod`(floor((1/2)*x), 2))*pr1+(1-(`mod`(floor((1/2)*x), 2)))*(1-pr1) end proc:

evalf[100](sum(pdf1(i), i = 3 .. 3)-pdf1(3));








evalf[100](sum(pdf2(i), i = 3 .. 3)-pdf2(3));





evalf[100](sum(sum(pdf3([i1, i2]), i2 = 1 .. 1), i1 = 1 .. 1)-pdf3([1, 1]));





evalf[100](sum(pdf4(i), i = 3 .. 3)-pdf4(3));













PiFast43 is freely available at,




I found this problem in a book about mathematica.
I want repeat it with maple.
But even Digits=1400, the exact value of s@x=70 is still different with the result(0.633319) on that book.
How to resolve this problem?
I want some help.


given the following:

param:= {mu[2] = (1600), mu[4] = (1500)}
R := unapply(1/(1+exp((1/50)*x)), x);

prior := evalf(expand(eval(eval(R(abs(mu[4]-mu[2])), `` = (x->x)), param)));

I need to keep the paramaters encapsulated. I would like this last step to output the answer 0.1192029.... but the abs function doesn't let me

Hello everybody,

I am working on a somewhat complicated analytical problem, which includes the evaluation of the following (finite and singularity free) double integral (the stated numerical parameters may vary):

Int(exp(18.1818*(Int((0.579160e-1*sqrt(x)*Ei(1., 0.500000e-4*x)+(1072.23*(.999950-1.*exp(-0.500000e-4*x)))/sqrt(x))/sqrt(x), x = 1. .. eta))-9.10000*eta)/eta, eta = 1. .. 100.)

There are no unevaluated variables inside (all the e's are real exp()s). However, when putting it through evalf(), Maple returns it (after calculating for some time) unevaluated. I have no idea why, as a simple box sum should succeed.

Any input would be appreciated. Best regards,

  K. Reuther


P.S.: Raw expression for further deliberations

Int(exp(18.1818*(Int((0.579160e-1*sqrt(x)*Ei(1., 0.500000e-4*x)+(1072.23*(.999950-1.*exp(-0.500000e-4*x)))/sqrt(x))/sqrt(x), x = 1. .. eta))-9.10000*eta)/eta, eta = 1. .. 100.)

x_1 = 1;

x_n = 1/2 (x_n-1 + 3/x_n-1 ) for n>=2

Is there a maple command to check if the above statement is rational, eventhough it is obvious enough?

I tried to evaluate x_2 using subs(n=2, x_n) but keep getting an expression in terms of x_1. Using evalf(x_2), the result was x_2.

I'm very new to maple, so please help :(


The alpha and beta are 'randomly' chosen, both >0, to produce some values, hence a value for the target function to optimize.

I am having trouble to evaluate the expression in the middle of the calculation.

Sometimes, the 'chosen' alpha and beta works fine with 'method = _d01amc' for numerical integration. and such way is really "fast".


But sometimes, the the 'chosen' alpha and beta will fail. Even when both of them are perfectly defined. and the integral can be easily evaluated using Int() and then evalf().


So what's be best way to proceed?



If I were to evaluate a single numerical integral, I can use evalf( Int(,method = _d01amc)).

But when the expression say is created by a built in function, Student[VectorCalculus][Hessian], from a complicated expression involve integrals. The resulting expression does not have the option "method = _d01amc". It then takes a long time to evaluate.

See this "HE" variable for example. HE.txt

value(HE); # takes a long time

evalf(HE); # takes a long time


Is there a way to evaluate "HE", using ",method = _d01amc" wherever necessary?



for example i want to save the Square root of 2 to 1000000 decimal place to an ascii text file ...

i used the writeto command after evalf[100](sqrt(2)) for but it contains line breaks and \ character in output !

but i only need the pure continues 1000000 digits !

please guide me on this simple request ?

Hi all

I have a mathematical problem and I asked it in various sites but the answers till yet are not correct.

Assume that we have:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, T[m](N*t-(n-1)*tj), 0), t):

where n,N,tj are known constants. furthermore assume that we want to comute the following integral:

for following approximations:

I have written the following code but it seems to be incorrect:


the original program is :


I will be so grateful if any one can help me to solve it by maple

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

evalf(10.2^20, 50);

evalf((10+1/5)^20, 50);


Where are 50 digits of the first result?

my codes list below.note the last line of the codes.evalf is not effective? the output is a long expression. how to force the maple to evaluate the long expression into a numeric value?


 ALL := [`$`(1 .. 3)]:
 solution_k := simplify(solve(map(proc (i) options operator, arrow:
 1/k[i] = (cos(Phi)*(x[i]-Tx)+sin(Phi)*(y[i]-Ty))/(-sin(Phi)*(x[i]-Tx)+cos(Phi)*(y[i]-Ty)) end proc, ALL), [Tx, Ty, Phi]), size):
 k := map(proc (i) options operator, arrow:
 tan(phi[i]) end proc, ALL):
 deg2rad := Tolerances:-`*`(Pi, Tolerances:-`^`(180, Tolerances:-`-`(1))):
 phi0[1] := Tolerances:-`*`(Pi, Tolerances:-`^`(3, Tolerances:-`-`(1))):
 phi0[2] := Pi:
 phi0[3] := Tolerances:-`-`(Tolerances:-`*`(Pi, Tolerances:-`^`(3, Tolerances:-`-`(1)))):
 alpha := Tolerances:-`*`(Pi, Tolerances:-`^`(10, Tolerances:-`-`(1))):
 L := 1:
 phi := phi0:
 x := map(proc (i) options operator, arrow:
 cos(phi0[i]+alpha)*L end proc, ALL):
 y := map(proc (i) options operator, arrow:
 sin(phi0[i]+alpha)*L end proc, ALL):
 angleError := Tolerances:-`&+-`(0, Tolerances:-`^`(10, -4)):
 locError := Tolerances:-`&+-`(0, Tolerances:-`^`(10, -4)):
 phi := map(proc (i) options operator, arrow:
 phi[i]+angleError end proc, ALL):
 x := map(proc (i) options operator, arrow:
 x[i]+locError end proc, ALL):
 y := map(proc (i) options operator, arrow:
 y[i]+locError end proc, ALL):



1 2 3 4 Page 2 of 4