Preben Alsholm

13728 Reputation

22 Badges

20 years, 241 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Anthrazit Have you tried my Round procedure?

If so, any comments?

Using an old procedure of mine (chop) I made up the following procedure Round which uses chop.
This combination is very likely unnecessarily clumsy and also not perfect otherwise.

Since, however, my computer is going to a repair shop for booting problems this morning, I dare give the code here with only a few examples.

restart;
chop:=proc (x::anything, n::nonnegint:=0) local op1, op2, k; 
   if not hastype(x,float) then return x end if; 
   if x::float then
     if n=0 then return round(x) end if; 
     op1, op2 := op(x); 
     k := length(op1); 
     evalf[n](round(op1*10^(-k+n))*10^(op2-n+k)) 
   else 
     map(procname,x,n) 
   end if 
end proc:
#####
chop(89.567,0);
chop(sin(1.)+cos(3));
chop(89.567,3);
#####
Round:=proc(x::anything,d::nonnegint:=0) local tr,fr,L,res;
  if not hastype(x,{realcons,complexcons}) then return x end if;
  if x::float or x::integer then 
     tr,fr:=(trunc,frac)(x);
     res:=chop(fr,d)+tr
  elif x::realcons then
     res:=procname(evalf(x),d)
  elif x::complexcons then
     res:=procname(Re(evalf(x)),d)+I*procname(Im(evalf(x)),d)
  else
     res:=evalindets(x,{realcons,complexcons},procname,d)
  end if;
  res
end proc:
#####
Round(4.56789,0);
sqrt(3.);
Round(sqrt(3),4);
Round(4567);
Round(sqrt(2*I),3);
Round([89,sqrt(2)],3);
Round(sin(Pi*x+I*sin(1)),0);
Round(Matrix([[78*Pi,sin(x*exp(1))],[exp(1)*I,erf(4)]]),4);


 

What should acer's Round(123456,2) return in your opinion?

@mmcdara There are in fact no imaginary parts. Those that do turn up after using evalf are artifacts of the floating point computation.

Try evalc(Im(EPS)) and also evalc(Re(EPS)) and you will see that Maple knows that Kummer functions in use are actually real. For perfect zeros in the first case (Im) it is important that the initial values are cleared of the small imaginary "artifacts".

An alternative is to avoid floats as in:

e4,e4_1:=op(eval([EPS1,diff(EPS1,t)],t=4));

and the other ones in the same way. It works, but the drawback is a builtup of huge symbolic expressions.

dsolve does indeed turn floats into rationals:

ode:=diff(y(x),x)=1.23*y(x);
dsolve(ode);

That has always been done in Maple at least as far as back to Maple 8 (the oldest on this computer).
This is definitely done purposely. I vaguely remember a discussion raised by somebody about that on MaplePrimes and that Edgardo Cheb-Terrab defended that handling.

@Carl Love Indeed weird with that number 10.

I do see that `limit/MrvRight` (called several times) in line 11 has the statement:

 if 10 <= nops(`limit/IndetsRange`(t)) then
        return _Range
 end if;

Whether that has anything to do with the importance of 10 I have no clue so far.

If you replace limit by MultiSeries:-limit you get 1.

restart;
I0:=(x - 11)^(n)*x/(x^(n + 1));                                              
I1:=(x - 11)^(n)/(x^(n));                                                    
is(I1=I0);  
Limit(I0,x=infinity)=MultiSeries:-limit(I0,x=infinity) assuming n::posint;
Limit(I1,x=infinity)=MultiSeries:-limit(I1,x=infinity) assuming n::posint;    
### Carl's example:
MultiSeries:-limit((x-a)^n*x/x^(n+1), x= infinity) assuming n::posint, a>10;
MultiSeries:-limit((x-a)^n*x/x^(n+1), x= infinity) assuming n::posint, a<10;

 

It has been noticed and mentioned by some (including very knowlegeable people) that the documentation for dsolve/numeric/events is very difficult to follow unless you in fact know all the terms used in advance. There ought to be many more examples to illustrate all the options mentioned.
As it is now you are basically on your own.
To get any help from this forum you need to be very concrete.

For 2015 I get 8.5 MB and for 2017 I get 7.7 MB using Windows 10.

With Maple 2019.2 I get a disastrous result: The program freezes. I have to kill it. The file was created, but had 0 bytes.
I tried 3 times with Maple 2019.2 with the same disastrous result.

I was using the following code in all 3 cases except that the file name test2019 changed.

with(plots);
plotsetup(postscript, plotoutput = `C:/Users/Bruger/test2019.eps`, plotoptions = `color,portrait,height=350,width=350`);
plot3d(x^2+y^2+1, x = -1 .. 1, y = -1 .. 1, axes = boxed, grid = [200, 200]);

 

Although my patience is not sufficiently large for me to see the message, I think that it is a warning, but not an error. Thus you should in principle have no problem.
I have seen it in other contexts.

@Kitonum The freely available package DirectSearch has the procedure GlobalOptima:
 

DirectSearch:-GlobalOptima(2*x^2 + 2*y^2 + y, {2*x + y <= 6, y^2 - x <= 2},maximize);

It returns: [46.1249999999993, [x = 4.24999999999998, y = -2.49999999999996], 173]

@ecterrab If you apply combine to the integrand Maple quickly gives up:
 

f:=(sin(lambda*x)*cos(mu)+cos(lambda*x)*sin(mu))^k*(x^n)^2;
fc:=combine(f);
int(fc, x);

 

@djc I use a Danish "speaking" computer bought in Denmark.

(Besides the point here, but that means that [ ] and { } are rather inconveniently placed on the keyboard and require AltGr + 8 for [  and similar for the other. That is a nuissance in Maple.)

@tomleslie I use Windows 10.
I found this:
Windows 10 Home, version 1903, installed 24-07-2019, Build 18362.720.

interface(version);
Standard Worksheet Interface, Maple 2020.0, Windows 10, March 4   2020 Build ID 1455132

 

 

@djc I get the same as acer.

kernelopts(version);
   Maple 2020.0, X86 64 WINDOWS, Mar 4 2020, Build ID 1455132

 

@Abdoulaye Z(0) = 0 determines the value of the parameter C (when a > 0).

The limits (= sup here) of the solutions for x -> infinity can be found for any concrete value of a > 0 and for 0 < a <= 1 it is largest for a = 1. The limit is 3.
I have just modified my worksheet to include this discussion at the bottom.

First 31 32 33 34 35 36 37 Last Page 33 of 230