Items tagged with digits digits Tagged Items Feed

How to find the maximum natural number n s. t. the sum of its cubed digits is greater than or equal to n? Of course, with Maple. The same question for the sum of the  digits to k-th power. Here are my unsuccessful attempts:
1.Optimization:-Maximize(n, {n <= convert(map(c ->c^3, convert(n, base, 10)), `+`)}, assume = integer);

Error, invalid input: `convert/base` expects its 1st argument, n, to be of type {integer, list(integer)}, but received n


2. for n while n <= convert(map(c ->c^3, convert(n, base, 10)), `+`) do print(n) end do;

                               1
                               2
                               3
                               4
                               5
                               6
                               7
                               8
                               9

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

I have a pair of markov matrices that are 250x250 and 500x500 in size. I am raising these matrices to high powers, like 10^17 by 10^12. (I'm using a do loop.) If I set digits:=15, Maple will use 100% of the processor that is available. If I set digits:=16+ Maple will only use 1 thread of my processor. Why? It is the same matrix same program. The only thing that changes is the digits of accuracy. This seems exactly backwards from what it should be. As a result, my AMD9590 processor will run full blast when I choose 15 digits of accuracy and gets the biggest matrix done in 1-2 hours. If i set the accuracy to 17 digits, it takes half a day or more to do the same thing!!! 2 digits of greater accuracy should not take an additional 20 hours!

 

Thanks 

I would like to announce a new unofficial record computation of the MRB constant that was finished on Sun 21 Sep 2014 18:35:06.

I really would like to see someone beat it with Maple!

It took 1 month 27 days 2 hours 45 minutes 15 seconds. I computed 3,014,991 digits of the MRB constant, (confirming my previous 2,00,000 or more digit computation was actually accurate to 2,009,993 digits), with Mathematica 10.0. I Used my version of Richard Crandall's code:

 

____________________________________________________________________________

(*Fastest (at MRB's end) as of 25 Jul 2014.*)

DateString[]

prec = 3000000;(*Number of required decimals.*)ClearSystemCache[];

T0 = SessionTime[];

expM[pre_] := 

  Module[{a, d, s, k, bb, c, n, end, iprec, xvals, x, pc, cores = 12, 

    tsize = 2^7, chunksize, start = 1, ll, ctab, 

    pr = Floor[1.005 pre]}, chunksize = cores*tsize;

   n = Floor[1.32 pr];

   end = Ceiling[n/chunksize];

   Print["Iterations required: ", n];

   Print["end ", end];

   Print[end*chunksize]; d = ChebyshevT[n, 3];

   {b, c, s} = {SetPrecision[-1, 1.1*n], -d, 0};

   iprec = Ceiling[pr/27];

   Do[xvals = Flatten[ParallelTable[Table[ll = start + j*tsize + l;

        x = N[E^(Log[ll]/(ll)), iprec];

        pc = iprec;

        While[pc < pr, pc = Min[3 pc, pr];

         x = SetPrecision[x, pc];

         y = x^ll - ll;

         x = x (1 - 2 y/((ll + 1) y + 2 ll ll));];(*N[Exp[Log[ll]/ll],

        pr]*)x, {l, 0, tsize - 1}], {j, 0, cores - 1}, 

       Method -> "EvaluationsPerKernel" -> 4]];

    ctab = ParallelTable[Table[c = b - c;

       ll = start + l - 2;

       b *= 2 (ll + n) (ll - n)/((ll + 1) (2 ll + 1));

       c, {l, chunksize}], Method -> "EvaluationsPerKernel" -> 2];

    s += ctab.(xvals - 1);

    start += chunksize;

    Print["done iter ", k*chunksize, " ", SessionTime[] - T0];, {k, 0,

      end - 1}];

   N[-s/d, pr]];

t2 = Timing[MRBtest2 = expM[prec];]; DateString[]

Print[MRBtest2]

MRBtest2 - MRBtest2M

_________________________________________________________________________.

 

I used a six core Intel(R) Core(TM) i7-3930K CPU @ 3.20 GHz 3.20 GHz with 64 GB of RAM of which only 16 GB was used.

t2 From the computation was {1.961004112059*10^6, Null}.

 

 

 

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 ?

How can I change the decimal to be displayed in the whole spreadsheet. The default decimals to be displayed is 4 in my version. How can I change it to another value? Also I don't want to click on "properties" each time I execute my worksheet. I want it to be automatically display  the number of digits I want. 

Say I have a 3x3 matrix with real entries (like 3.4) and want to compute, say, A^(11). How can I do it and only have 5 digits in the output? I set Digits:=5; and used MatrixPower -- but got 10 digits, which is way too many for the classroom presentation.

I am trying to illustrate the effects of using finite-precision arithmetic on solving certain linear systems using elementary row operations. I am able to set Digits to the desired level and use the RowOperation command for each individual row operation. I would like to be use say, ReducedRowEchelonForm or LinearSolve with the desired level of precision. Is there anyway to force Maple to use whatever number of digits when using commands like ReducedRowEchelonForm or LinearSolve?...

For example, how to round 45.67845 up to 3 digits after comma?

expected answer - 45.678

Hello,

I want to calculate the IDs product :

 

I have some numerical data, which are very accurate (500 digits) and want to copy them on a text file.

For pratical reason I would like the procedure writefile to write just 20 digits figures: which is the right syntax to use?

Digits:=20;

p:=proc() global Digits; Digits:=Digits+5;end proc;

Digits;

Obtained 20 at the end. Which variables has also such property of "recoveriability" after proc call?

hi

 

i have written the followin code that achieve Y from determinant of matric aa. but when i change digit my result changes. i dont know why? 

 

> restart;
> with(LinearAlgebra);
> Digits := 100;
>
> NULL;
> upsilon := .38;
> rho := 0.122e4;
> l := 0.176e-4;
> h := 2*0.176e-4;
> L := 20*h;
> NULL;
> E := 0.144e10;
> lambda := E*upsilon/((1+upsilon)*(1-2*upsilon));

On the usenet newsgroup sci.math.symbolic Prof. Richard Fateman posted a question (or here) recently about what mechanisms a math application could use to handle the situation of negligible imaginary parts of computed data when plotting.

An example could...

And so with this provocative title, "pushing dsolve to its limits" I want to share some difficulties I've been having in doing just that. I'm looking at a dynamic system of 3 ODEs. The system has a continuum of stationary points along a line. For each point on the line, there exist a stable (center) manifold, also a line, such that the point may be approached from both directions. However, simulating the converging trajectory has proven difficult.

I have simulated as...

1 2 Page 1 of 2