Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

My Maple 14 uses HeunG, no HG appears.

@GeorgesL In any case, it is not a bug. It is a decision that was made. What do you think 0^k should evaluate to, when k is unassigned?

@GeorgesL In any case, it is not a bug. It is a decision that was made. What do you think 0^k should evaluate to, when k is unassigned?

Good question.

I think the solution f = constant and g = 0 is unstable, so if your solution approaches such a solution the numerical solution may run into severe problems.

So you got work to do :-)

Good question.

I think the solution f = constant and g = 0 is unstable, so if your solution approaches such a solution the numerical solution may run into severe problems.

So you got work to do :-)

@soechristian Here is a simple example.

sys:={y=x^2-1,y=x};
res:=solve(sys,{x,y},explicit);

#This is just an example of the use of evaluating some expression at res[1] or res[2]:

expand(eval(x^2+y^2-1,res[1]));
expand(eval(x^2+y^2-1,res[2]));

#Now actually assigning
assign(res[1]);
x,y;

res[1] refers to the first result in the sequence res.

@soechristian Here is a simple example.

sys:={y=x^2-1,y=x};
res:=solve(sys,{x,y},explicit);

#This is just an example of the use of evaluating some expression at res[1] or res[2]:

expand(eval(x^2+y^2-1,res[1]));
expand(eval(x^2+y^2-1,res[2]));

#Now actually assigning
assign(res[1]);
x,y;

res[1] refers to the first result in the sequence res.

@hirnyk For some functions coords = polar makes the pictures look nice:

 

plots:-conformal(z,z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The z-plane"):

plots:-conformal(z,z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The z-plane")
plots:-conformal(sec(z),z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The w-plane"):

plots:-conformal(sec(z),z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The w-plane")
plots:-display(Array([%%,%]));

@hirnyk For some functions coords = polar makes the pictures look nice:

 

plots:-conformal(z,z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The z-plane"):

plots:-conformal(z,z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The z-plane")
plots:-conformal(sec(z),z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The w-plane"):

plots:-conformal(sec(z),z=0..1+Pi*I,numxy=[20,100],grid=[10,25],coords=polar,scaling=constrained,caption="The w-plane")
plots:-display(Array([%%,%]));

@Orion Is it going to help any to replace ``  with f (assuming that f doesn't evaluate to anything but its own name)? As in

eval(p2(u),``=f);

At least you only get a warning when doing

CodeGeneration:-Fortran(eval(p2(u),``=f));

You would have to remove f all over the place though. But that could be done in a text editor with Edit/replace.

@Orion Is it going to help any to replace ``  with f (assuming that f doesn't evaluate to anything but its own name)? As in

eval(p2(u),``=f);

At least you only get a warning when doing

CodeGeneration:-Fortran(eval(p2(u),``=f));

You would have to remove f all over the place though. But that could be done in a text editor with Edit/replace.

Extending the above procedure to arbitrary integral powers:

CombineLikePowers:=proc(u::algebraic,L::{posint,set(posint),list(posint)}:=infinity) local S0,S,k,u0,u1,u2,u3,u4;
    if type(u,`+`) then
       map(procname,u,L)
    elif type(u,`*`) then
       u0:=evalindets(u,function,freeze);
       if not member(true,map(type,{op(u0)},{name^posint,name^negint})) then return u end if;
       S0:=map(abs,map2(op,2,indets(u0,`^`(anything,integer)))) minus {1};
       if L=infinity then
          S:=S0
       elif type(L,posint) then
          S:={L} intersect S0
       else
          S:=convert(L,set) intersect S0
       end if;
       for k in S do
       u1:=evalindets(u0,{algebraic^k,algebraic^(-k)},x->``(root[k](x,symbolic)));
       u2,u3:=selectremove(type,u1,specfunc(algebraic,``));
       u4:=``(eval(u2,``=(()->args)))^k*u3;
       u0:=evalindets(u4,specfunc({name,`^`},``),expand);
       end do;
       thaw(u0)      
    else
       u
    end if
end proc;

You may try it on something like

w:=expand(randpoly([x,y,sin(x^2)],degree=4,dense)/a^4/b^3);

You could do

CombineLikePowers(w);

or if you only want powers 2 and 3:

CombineLikePowers(w,{2,3});

Extending the above procedure to arbitrary integral powers:

CombineLikePowers:=proc(u::algebraic,L::{posint,set(posint),list(posint)}:=infinity) local S0,S,k,u0,u1,u2,u3,u4;
    if type(u,`+`) then
       map(procname,u,L)
    elif type(u,`*`) then
       u0:=evalindets(u,function,freeze);
       if not member(true,map(type,{op(u0)},{name^posint,name^negint})) then return u end if;
       S0:=map(abs,map2(op,2,indets(u0,`^`(anything,integer)))) minus {1};
       if L=infinity then
          S:=S0
       elif type(L,posint) then
          S:={L} intersect S0
       else
          S:=convert(L,set) intersect S0
       end if;
       for k in S do
       u1:=evalindets(u0,{algebraic^k,algebraic^(-k)},x->``(root[k](x,symbolic)));
       u2,u3:=selectremove(type,u1,specfunc(algebraic,``));
       u4:=``(eval(u2,``=(()->args)))^k*u3;
       u0:=evalindets(u4,specfunc({name,`^`},``),expand);
       end do;
       thaw(u0)      
    else
       u
    end if
end proc;

You may try it on something like

w:=expand(randpoly([x,y,sin(x^2)],degree=4,dense)/a^4/b^3);

You could do

CombineLikePowers(w);

or if you only want powers 2 and 3:

CombineLikePowers(w,{2,3});

@Alex Smith You are missing the point, which (as I understod it) was to integrate term by term, which is NOT done when you do

value(Int((sum(x^(2*k+1), k = 1 .. infinity))*sqrt(1-x), x = 0 .. 1));

because

Int((sum(x^(2*k+1), k = 1 .. infinity))*sqrt(1-x), x = 0 .. 1);

is not the integral of an infinite sum as I pointed out in my answer above (In the remark: "This is not really an infinite summation example since Maple first computes the sum").


@Alex Smith You are missing the point, which (as I understod it) was to integrate term by term, which is NOT done when you do

value(Int((sum(x^(2*k+1), k = 1 .. infinity))*sqrt(1-x), x = 0 .. 1));

because

Int((sum(x^(2*k+1), k = 1 .. infinity))*sqrt(1-x), x = 0 .. 1);

is not the integral of an infinite sum as I pointed out in my answer above (In the remark: "This is not really an infinite summation example since Maple first computes the sum").


First 219 220 221 222 223 224 225 Last Page 221 of 231