Preben Alsholm

13010 Reputation

22 Badges

18 years, 182 days

MaplePrimes Activity


These are questions asked by Preben Alsholm

It appears that email notifications have gone on Christmas vacation.
When will they be back?

What are the stopping criteria for fsolve?
I cannot find anything in the help page and there seems to be no way of adding an optional argument to fsolve about errors.

I was initially surprised by the results of the first two fsolve commands below:

restart;
infolevel[fsolve]:=2:
fsolve([x->1,x->3],[0.4,8]);
fsolve([x->1,x->3],[0..7,8..9]);
fsolve(x->1,0.4); #OK, returns unevaluated
fsolve([1,1],{x,y}); #OK, returns NULL

I assume that in the first two examples the criterion used is that at some point in the process the iterates [x(n+1),y(n+1)] and [x(n),y(n)] are close enough together and the difference between results from the two is small enough (clearly 0).

To me the following behavior of solve is surprising:

restart;
solve(f(0.5)=7,f(0.5)); #Output NULL
solve(f(1/2)=7,f(1/2)); #Output as expected 7

Debugging solve suggested to me that the following might work
solve(f(0.5)=7,f(1/2));
and indeed it did (outout the float 7.).
This behavior seems to have started in Maple 10. I checked Maple V,R3 and several other old versions including Maple 9.5. All behaved as I would have expected. MapleV,R3 gave the float 7. in the first case, the other the integer 7.
I take this to be a bug and shall file an SCR.
Any comments?




I'm not being notified anymore about responses to answers or comments to MaplePrimes. I'm assuming that I'm not the only one (?). This has happened before.

A large procedure I made caused me some problems. I finally found the source of the problem.
There seems to be some interaction between the end of parameters marker, $, and the elementwise operation ~.

Consider these 3 versions of essentially the same procedure:

restart;
Q1:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
       subs(Var=~[seq(1..n)],var); #Elementwise
  end proc;
end proc:
Q1([x,y]); #Doesn't work : "invalid expression"
Q2:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
      subs(zip(`=`,Var,[seq(1..n)]),var); # zip
  end proc;
end proc:
Q2([x,y]); #No problem
Q3:=proc(Var::list) local n; #No end of parameters marker $
  n:=nops(Var);
  print(Var,n);
  proc(var::list)
       subs(Var=~[seq(1..n)],var); # Elementwise
  end proc;
end proc:
Q3([x,y]); # No problem
lprint(Q3([x,y])); #Curious output involving ` $`
#A fourth procedure in which the output is not a procedure works:
Q4:=proc(Var::list,$) local n;
  n:=nops(Var);
  print(Var,n);
  subs(Var=~[seq(1..n)],Var)
end proc:
Q4([x,y]);

Does anybody have any comments? Is it a bug?

1 2 3 4 Page 3 of 4