tomleslie

13876 Reputation

20 Badges

15 years, 181 days

MaplePrimes Activity


These are replies submitted by tomleslie

works fairly quickly (<10secs) in

Maple 2019
Maple 2018

but fails, or at least takes too long (>1min) for my patience in

Maple 2017
Maple 2016
Maple 2015
Maple 18

By the way responders on this site are Maple users, not (generally-speaking) Maple employees

I have previously noted that *sometimes* the fourier() command "fails", but performing the integration explicitly "works"

This shouldn't really be the case, because (according to the help page), if the command fourier() cannot find the transform in its look-up table, then explict integration is attempted (unless the user sets the NO_INT option)

Even setting 'infolevel' quite high it is not obvious (to me at least) that the fourier() command is even trying explicit integration.

In the attached, explicit integration workss for the erf() function

  restart;
  interface(rtablesize=10):
  interface(version);
  Physics:-Version();

`Standard Worksheet Interface, Maple 2019.0, Windows 7, March 9 2019 Build ID 1384062`

 

"C:\Users\TomLeslie\maple\toolbox\2019\Physics Updates\lib\Physics Updates.maple", `2019, April 26, 7:48 hours, version in the MapleCloud: 354, version installed in this computer: 350.`

(1)

  with(inttrans):
  infolevel[fourier]:=20;
  S := x->erf(x):
#
# No answer from fourier()
#
  ft1:=fourier(S(t),t,w);

20

 

fourier: Entering fourier with erf(t)
inttrans/fourier/lookup: Enter with  erf(t) t v
inttrans/fourier/lookup: Returning  FAIL
inttrans/fourier/main: Entering with erf(t) t v
inttrans/fourier/lookup: Enter with  erf(t) t _S
inttrans/fourier/lookup: Returning  FAIL

inttrans/fourier/main: Leaving(3) with fourier(erf(t) t v)

 

fourier(erf(t), t, w)

(2)

#
# But for the erf() function, integrating explicitly
# just "works"
#
  ft2:=int( S(t)*exp(-I*w*t), t=-infinity..infinity);
  plot( abs(ft2), w=0..10);

-(2*I)*exp(-(1/4)*w^2)/w

 

 

 

 

Download erfFour.mw

using the big green up-arrow in the Mapleprimes toolbar

@Hajra Zeb 

the matrix for any value of 'tau' ( eg 2) just by performing

eval(A, tau=2)

@asma khan 

eval(X, [seq( x[j]=-1+j/3, j=0..N)]);

to my previous worksheet

@radaar 

in the Mapleprimes toolbar, post the "offending" worksheet and specify the Maple version you are using.

@radaar 

depends on the arguments - if these are completely general, then probably(?) not. If these have domains restricted in some way, then possibly(?)

@radaar 

Well, what kind of speedups might be available depend very much on the nature of the arguments which you are supplying to the pochhammer() function.

In the test case you supply, both of these are positive integers. If this is generally true, then use of the pochhammer() function is overkill. There are far more efficient ways to get the same answer.

Such methods *may* be applicable in other cases depending on the domains of the arguments.

Consider the attached, which provides a ~100X speed-up for your test case,  using neither evalf() nor evalhf()

  restart;
  interface(rtablesize = 10):
  hh := proc(cc::Array)
             local i;
             return add
                    ( pochhammer
                      ( cc[i],
                        2
                      ),
                      i = 1 .. 1000
                    );
      end proc:
  CodeTools:-Usage( evalf
                    ( hh
                      ( Array
                        ( 1 .. 1000,
                          [ seq
                            ( h,
                              h = 1 .. 1000
                            )
                          ]
                        )
                      )
                    )
                  );

memory used=40.18MiB, alloc change=39.01MiB, cpu time=296.00ms, real time=296.00ms, gc time=0ns

 

334334000.0

(1)

  M:=(z,n)-> local j;
             mul( j,
                  j=z..z+n-1
                ):
  CodeTools:-Usage( add
                    ( M(h,2),
                      h = 1 .. 1000
                    )
                  );

memory used=159.92KiB, alloc change=0 bytes, cpu time=0ns, real time=3.00ms, gc time=0ns

 

334334000

(2)

``


 

Download evPoch2.mw

@guru kido 

You have used the option metric=arbitrary in the Setup() command.

Neither your original post, nor my earlier response, used this option

@reza gugheri 

which input style you are using: this will be either

  1. 'Maple Input', or
  2. '2D Input'

Then from the menus, choose Format->Styles: select the appropriate 'style' from the resulting pop-up, then modify it to anything you want (including color)

I have just run this problem through the last few Maple versions

Maple 18:-     No error generated, but no answer
Maple 2015:- No error generated, but no answer
Maple 2016:- No error generated, but no answer
Maple 2017:- No error generated, provides an answer
Maple 2018:- No error generated, provides an answer
Maple 2019:- No error generated, provides an answer

So which version of Maple are you running???

Post a worksheet (big green up-arrow in the Mapleprimes toolbar) which illustrates your problem
 

@acer 

and I may(?) want to withdraw my earlier post, but there is still something odd going on in the attached. Why is the first result different form the others?????

restart;

kernelopts(version)

`Maple 2019.0, X86 64 WINDOWS, Mar 9 2019, Build ID 1384062`

(1)

with(VectorCalculus):

assume(x, 'real');
assume(y, 'real');

D[1]((x, y) ->x^2-y^2);

proc (x, y) options operator, arrow; 0 end proc

(2)

restart;

kernelopts(version)

`Maple 2019.0, X86 64 WINDOWS, Mar 9 2019, Build ID 1384062`

(3)

#with(VectorCalculus):

assume(x, 'real');
assume(y, 'real');

D[1]((x, y) ->x^2-y^2);

proc (x, y) options operator, arrow; 2*x end proc

(4)

restart;

kernelopts(version)

`Maple 2019.0, X86 64 WINDOWS, Mar 9 2019, Build ID 1384062`

(5)

with(VectorCalculus):

#assume(x, 'real');
#assume(y, 'real');

D[1]((x, y) ->x^2-y^2);

proc (x, y) options operator, arrow; 2*x end proc

(6)

 


 

Download confused.mw

The code

restart;
with(VectorCalculus):
assume(x, 'real');
assume(y, 'real');
D[1]((x, y) ->x^2-y^2);

Produces

(x,y)->2 x in Maple 18
(x,y)->2 x in Maple 2015.2
(x,y)->0    in Maple 2016.0
(x,y)->0    in Maple 2017
(x,y)->0    in Maple 2018
(x,y)->0    in Maple 2019

The code

restart;
with(VectorCalculus):
# assume(x, 'real');
# assume(y, 'real');
D[1]((x, y) ->x^2-y^2);

produces

(x,y)->0    in Maple 2019

The code

restart;
#with(VectorCalculus):
assume(x, 'real');
assume(y, 'real');
D[1]((x, y) ->x^2-y^2);

produces

(x,y)->2 x in Maple 2019

So there is definitely something very very odd going on here

@mmcdara 

for

  1. Still a pretty basic solution
  2. Evaluating dsolve() once - I should have done this before
  3. Explanation of parameter passing


(and the output still won't appear on this site!)

  restart;

  interface(rtablesize=10):
  with(plots):
#
# Define/solve the ODE
#
  sys:={ diff(x(t), t) = a*t, x(0)=0 }:
  sol:= dsolve(sys, numeric, parameters=[a]):
#
# Define the function for use with Explore().
# Note that this accepts as arguments
#
# 1. A real constant which will be used for
#    the value of the parameter in (2) below
# 2. The solution procedure for the ODE, which
#    contains a parameter. This parameter will
#    be set to the value specified in (1) above
#
  f:= proc(b::realcons, ans::procedure)
           uses plots:
           ans(parameters=[b]):
           return odeplot( ans, [t, x(t)], t=0..1, view=[0..1, 0..3]);
      end proc:
#
# 'Name' used for parameters variable in the Rxplore
# command is more or less irrelevant for the purposes
# of "calculation". The sub-option "label" can be used
# to determine what appears beside the slider control
#
  Explore( display(f(x, sol)),
           parameters=[[x=1..5, label=`a`]]
         );

  

 

 

 


 

Download dsolExpl2.mw

First 67 68 69 70 71 72 73 Last Page 69 of 207