Items tagged with evalf

Maple 15

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

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

evalf.mw

 


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?

restart

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));

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.

(1)

``

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

0.660577190488235341051011619131468981956415371043397988049446125095986885183932081422133231891679108e-1

 

0.

(2)

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

0.1e-99

 

0.

(3)

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

-0.5916138463847142610167458259917350166697832274100937926782390907759215172519498e-21

 

0.

(4)

``

``

``

``

 

Download maple_bug.mw

 

 

PS,
PiFast43 is freely available at,

http://numbers.computation.free.fr/Constants/PiProgram/pifast.html

 

 

 

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.

code:
restart;
Digits:=1400:
p:=convert(series(cos(x),x,201),polynom):
s:=add(op(i,p),i=[1,2,3,-1,-2,-3]);
add(evalf(coeff(p,x,i))*70^i,i=[200,198,196])+add(evalf(coeff(p,x,i))*70^i,i=[2])+add(evalf(coeff(p,x,i))*70^i,i=[4]);
#plot(s,x=0..40,view=[0..40,-2..2],numpoints=6000,gridlines,style=point);
simplify(eval(s,x=70));
evalf(%);

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

Hi,

So I have a simple while loop and keep receiving this error and have no idea how to fix it. I don't get why it works for the first few, and then the error starts. Here is my code and output:

Input:

restart;
n:=0:
x:=Pi/3;
m:=0:
total:=0:
while abs(1/2-total) > 10^(-8) do
k:=((-1)^(n/(2))*x^(n))/(n!):
total:= total +k;
evalf(total, 11);
print(%);
n:=+2;
end do:

OUTPUT:
1
- Pi
3
1.
0.45168864437
Error, cannot determine if this expression is true or false: 0 < -50000001/100000000+(1/18)*Pi^2

 

Why does it think i'm asking if something is greater than 0? Any help??

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

See AAAA.mw

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?

Thanks,

casperyc

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?

 

Thanks!

Greetings

I am left wondering why evalf as well as right clicking and selecting approximate both are in error.

Try 1/2*sqrt(109) and find a solution with 5 digits (english isnt my first language so the wording may not be correct).

If you calculate it as 1/2*sqrt(109.0) you correctly get 5.2202

However, if you use evalf(1/2*sqrt(109)) or 1/2*sqrt(109) then right click and approximate with 5 digits you incorrectly get 5.2200.

I assume this is because both incorrectly round to 5 digits on sqrt(109) before dividing by 2 - a common mistake for very inexperienced students but surely not something I would expect from Maple.

Please explain and better yet fix. Thanks.

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:

T[m]:=t->t^m:
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:

V1:=Vector([seq(seq(b[n,m](t),m=0..1),n=1..3)]);
V:=evalf(V1.Transpose(V1));

the original program is :

taaylor.mws

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

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

1 2 3 4 5 Page 2 of 5