Axel Vogt

5941 Reputation

20 Badges

21 years, 4 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are replies submitted by Axel Vogt

What happens if you write as Int instead of Intat ?

@acer 

I think the essential point is that Jones provides a *simple* formula for *enumerating*
primes - though it may be not very helpfull for larger inputs.

For improving speed one may use the following

J3:=proc(n::integer)
local m, s, i, p, j, f, k;
m := n*ceil( log(n) + log(log(n)) ); # AVt from Jones
s := 1;
for i to m do
  p := 0;
  for j to i do
    f := 1;
    for k to j-1 do
      f := f*k*k;
      f := f mod j;
      if f=0 then k:=j-1; next; end if; # acer
    end do;
    p := p+f
  end do;
  s := s+max(0,1-max(0,p-n))
end do;
s
end proc;

On my old machine and n=40 timings for the compiled versions are:

23 sec for cJ, 6.4 sec using your simplification and 32 msec for the above.

PS: For the overflow note that multiplication (like "!") and modulo can be interchanged
if one wants to stay close to the original and to avoid it.

Edit: The case n=1 has to be added as special case.

@michaelvio 

K:=Int(T2, x = 1/t0 .. 1/t0 + 1.542976947*10^(-13), epsilon=1e-6);
plot(K, t0= 1e5 .. 1e7, numpoints=5);

PS: I always use Digits:=15 (see Carl Love's answer)

@michaelvio 

J is a function of x0. Say you have JJ = Int(1/x^2, x=x0 .. x0+1). What you want to do in that case?

@michaelvio 

That epsilon controls the relative error for numerical integration, please read the help pages on Numerical Integration.

The other part of your reply is completely unclear: J is a function of x0, not of x, J = Int(f(x), x=x0 .. x0+constant). You might write down more precisely what you are looking for.

J:=Int(T2, x = x0 .. x0 + 1.542976947*10^(-13), epsilon=1e-6);
plot(J, x0= 1e-7 .. 1e-5, numpoints=5);

@Carl Love works for me = the command timelimit works (Win 7, Maple 2024.1)

works for me, have no Physics installed

@C_R I just corrected the link

@C_R The above fmod may be not quite what one wants since fmod(10,10) returns 10.0 instead of 0.

For positive numbers frac(t/m)*m already works, more general use R:= (t,m) -> t - floor(t/m)*m,
see https://www.mapleprimes.com/questions/36061-Modulo-Not-Only-For-Integers#answer60554 (Robert Israel)

Your expesssion is (-csgn(sqrt(-1 - sqrt(3)*I)*(8*x^(3/2) + c)^(1/3)) - 1)*sqrt(x), c__1=c/12

 

Why not using the File Explorer ?

I do not expect that Maple covers everything in teaching.

For your last examples I would consider limits and continuity of products or squaring or similar to interchange operations, say f(x)*g(x) for f(x)=x, g(x)=x*ln(x) or lim(h(x)^2) = lim(h(x))^2 for continuous functions.

Enough from my side for this thread.

You might have a look at Wikipedia and its explanations, https://en.wikipedia.org/wiki/L%27H%C3%B4pital%27s_rule

There is no need to understand Mathematics by using Maple

For my very old office PC I get roughly 1/2 minute, 15 times slower than dharr. Not that bad (Maple 2024.1, Win 7, Intel Pentium 630, 2.70 GHz, 2 CPUs)

1 2 3 4 5 6 7 Last Page 1 of 209