Preben Alsholm

13728 Reputation

22 Badges

20 years, 247 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Using the defining sum from the help pages we get:
 

restart;
S:=Sum(z^k*(product(pochhammer(n[i], k), i = 1 .. p))/(factorial(k)*(product(pochhammer(d[j], k), j = 1 .. q))), k = 0 .. infinity);
n:=[1, -1, 1/2];
d:= [-12,-3];
p:=nops(n);
q:=nops(d);
S;
value(S);

So the answer for z = 1 would be 71/72, which agrees with the numerical evaluation of the sum:

evalf(eval(S,z=1));
evalf(71/72);
# Interestingly, using the inert form with evalf gives the same answer (i.e. evalf(71/72)):

Hypergeom([1, -1, 1/2], [-12,-3], 1);
evalf(%);
Finally, you can try replacing z=1 with z=1.0:

hypergeom([1, -1, 1/2], [-12,-3], 1.0);

Thus I'm convinced you have found a bug. I shall report it as an SCR (Software Change Request).

@John Fredsted I couldn't agree more.

@denny The reason it doesn't make any difference in your case is that the ordering in sets is lexorder.
So try this:

restart;
{x(t),xdot(t)}; #order kept because x comes before xd in a dictionary.
restart;
{xdot(t),x(t)}; # same order in output as above.
restart;
{xm(t),xdot(t)}; #order reversed because xd comes before xm in a dictionary.
{xdot(t),xm(t)}; # order kept
### So use a list, when you want a particular order.

 

To be sure that the plot comes out with x along the horizontal axis and xdot along the vertical axis, use a list instead of a set.
Thus use [x(t), xdot(t)].
To see that it matters you could try your existing command with x(t) and xdot reversed just to see if you have control:
DEplot(sys,{xdot(t),x(t)}, ... and the rest ); #xdot along the vertical axis
Compare with
DEplot(sys,[xdot(t),x(t)], ... and the rest ); #x along the vertical axis

I got to think that you may wonder why the message `[Length of output exceeds limit of 1000000]`  came up, since Maple's own procedures are by default only printed as a meager skeleton.
To see why, try the simple code below.

restart;
ode:=diff(x(t),t)=x(t);
dsolve({ode,x(0)=1},numeric); # Only a skeleton is printed
interface(verboseproc); # default value 1
interface(verboseproc=2); # Setting the value to 2
dsolve({ode,x(0)=1},numeric); # Lots of stuff even for this simple problem.

 

The last value in HA, i.e. 0.8 can be handled by raising abserr and maxmesh some.
The following worked for me with the default setting of Digits at 10.

res[5] := dsolve(eval({Eq1, Eq2, Eq3, Eq4, IC1, IC2}, params union {K1 = lambda*HA[5]}), numeric,maxmesh=2048,abserr=1e-4,continuation=lambda);

It took a while and the message
`[Length of output exceeds limit of 1000000]`
came up. That is not an error message, so just ignore it.
The graphs of F and G at that value of K1:
plots:-odeplot(res[5],[[eta,F(eta)],[eta,G(eta)]]);

Actually, it is a bug in the local procedure InputCheck:

showstat(Student:-NumericalAnalysis::InputCheck,1..4);

InputCheck := proc(ODE, IC, trange)
local de, dvar, fde, ivar, range, dvar_i, ivar_r, leftend, inival;
   1   if has(lhs(ODE),'D') then
   2     de := convert(lhs(ODE),'diff') = fde
       else
   3     de := ODE
       end if;
   4   fde := rhs(de);
       ...
end proc

de is defined in line 2 (in your case)  as diff(y(t),t) = fde (not assigned yet).
Then in line 4 fde is assigned the value of rhs(de), which of course is just itself.
Thus fde remains unassigned at this stage and it remains so.
It is as simple as this:

ODE:=D(y)(t) = t*y(t)+1/y(t);
de:=convert(lhs(ODE),diff)=fde;
fde:=rhs(de);
de;

######### I shall report the bug via an SCR.

I interpreted your reply to ThU in http://mapleprimes.com/questions/220473-Getting-Maple-To-Simplify-A-Power-Series   as saying that you would post executable code instead of a picture in the future.
When does the future begin?

If we may assume that gamma is not Euler's constant, but some parameter, then it is pretty simple to find the maximal value for gamma for which the problematic denominator is negative on the whole interval 0..3.
The value is 0.348922854747400.

To get a concise answer you should tell us if you are talking about a function of one or several variables.
Better yet, give us an example of a function of the type you are thinking about.

@umar khan Just copy and paste the code I gave into a fresh worksheet.  You could then just execute, but when copied like that, all commands will be in the same execution group, so all commands will be executed with just one punch on Enter, which is most often not desired.
Use the F3 key on your keyboard to separate into several execution groups, one at a time. Place the cursor in front of a command, press F3 and watch the result. The F4 key does the opposite, it joins execution groups.
I did that on my own computer and the result is this:
MaplePrimes16-12-11odesysCP.mw

This is a minor point, but you use gamma. That is Euler's constant in Maple. Was that intended?
Euler's constant is to 10 digits:
evalf(gamma);
     .5772156649
If I try replacing gamma by 0.1 the problems don't show up.
Using Tom Leslie's notation try

indets(odesys,name);
odesysG:=eval(odesys,gamma=.1);
and then work with odesysG instead.

Thus my question about gamma may not be so minor anyway.
What was gamma supposed to be?

 

@tomleslie Doing

solve(odesys,diff~({F,G,H,thetaP}(eta),eta) union {diff(f(eta), eta$3),diff(theta(eta), eta, eta)});

we find that the denominator in the theta equation is   2.308862660*f(eta)^2-1.
Plotting that denominator using the solution sol1, we see that the denominator becomes zero at a point between eta = 1 and eta = 1.5.
This would certainly give problems:

plots:-odeplot(sol1,[eta,2.308862660*f(eta)^2-1.]);

The corrected syntax is
sol := dsolve(sys union { P(ep) = 1.3668*10^14, m(ep) = 0, rho(ep)=4.2983*10^(14),v(ep)=-0.7342}, numeric,method=rosenbrock, range = 0 .. 20*10^(5));

But you have other problems. I have no time to address those now.

@ My Maple 8 basically only works "under protest". If I try to save anything (or open anything) it closes immediately. I have to run it as administrator each time.
But here is a paste of the screen:

restart;
> s1:=proc(n,x)
> local y,xx,i,j,zz::array(1..n,1..n);
> for i from 1 to n do for j from 1 to n do zz[i,j]:=x[i]*(1+x[j]^2);od:
> od:
> y:=array(1..2,[(1)=x, (2)=zz]):
> for j from 1 to n do xx[i]:=zz[i,i]/(add(zz[i,j],j=1..n));od:
> 0;
> end proc;

  s1 := proc(n, x)
local y, xx, i, j, zz::array(1 .. n, 1 .. n);
    for i to n do
        for j to n do zz[i, j] := x[i]*(1 + x[j]^2) end do
    end do;
    y := array(1 .. 2, [1 = x, 2 = zz]);
    for j to n do xx[i] := zz[i, i]/add(zz[i, j], j = 1 .. n)
    end do;
    0
end proc

> showstat(s1);
>

s1 := proc(n, x)
local y, xx, i, j, zz::array(1 .. n,1 .. n);
   1   for i to n do
   2     for j to n do
   3       zz[i,j] := x[i]*(1+x[j]^2)
         end do
       end do;
   4   y := array(1 .. 2,[1 = x, 2 = zz]);
   5   for j to n do
   6     xx[i] := zz[i,i]/add(zz[i,j],j = 1 .. n)
       end do;
   7   0
end proc

> x0:=Vector(2,[1,1]);
>

                                    [1]
                              x0 := [ ]
                                    [1]

> s1(2,x0);
>

                                  0

> stopat(s1,4);
>

                                 [s1]

> s1(2,x0);
>
2
s1:
   4*  y := array(1 .. 2,[1 = x, 2 = zz]);

> next
array(1 .. 2,[(1)=(Vector[column](2, [1,1], datatype = anything, storage = rectangular, order = Fortran_order, shape = [])),(2)=zz])
s1:
   5   for j to n do
         ...
       end do;

> Y:=eval(y);
s1:
   5   for j to n do
         ...
       end do;

> quit
Warning, computation interrupted

> eval(Y);
>

                              [[1]    ]
                              [[ ], zz]
                              [[1]    ]

> unstopat(s1);
>

                                  []


########## I notice that the debugger prompts DBR> just becomes > when copying and pasting.
Here is a pure text version:
test.txt

First 70 71 72 73 74 75 76 Last Page 72 of 230