Robert Israel

6577 Reputation

21 Badges

18 years, 209 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

This ought to work.
> P:= plot3d(...):
  A:= op([1,3],P):
  a,b:= op(op([1,1],P)):
  c,d:= op(op([1,2],P)):
  m:= rhs(rtable_dims(A)[1]):
  n:= rhs(rtable_dims(A)[2]):
  for i from 1 to m do
   for j from 1 to n do
     X:= ((m-i)*a + (i-1)*b)/(m-1);
     Y:= ((n-j)*c + (j-1)*d)/(n-1);
     fprintf("c:/mydir/myfile.txt",
         "%f  %f  %f\n",X,Y,A[i,j]);
   end do
  end do:
  close("c:/mydir/myfile.txt"):
This ought to work.
> P:= plot3d(...):
  A:= op([1,3],P):
  a,b:= op(op([1,1],P)):
  c,d:= op(op([1,2],P)):
  m:= rhs(rtable_dims(A)[1]):
  n:= rhs(rtable_dims(A)[2]):
  for i from 1 to m do
   for j from 1 to n do
     X:= ((m-i)*a + (i-1)*b)/(m-1);
     Y:= ((n-j)*c + (j-1)*d)/(n-1);
     fprintf("c:/mydir/myfile.txt",
         "%f  %f  %f\n",X,Y,A[i,j]);
   end do
  end do:
  close("c:/mydir/myfile.txt"):
You can get some information on some of the methods Maple uses from the help page ?LinearAlgebra,Determinant. In particular, if you're talking about polynomials in one variable x with integer coefficients, you might try method=univar[x] which uses modular homomorphisms and the Chinese Remainder Theorem.
The logical operators (not, and, or) all have lower binding strength than =. This means that your
not(P or Q) = (not P) and (not Q) 
is actually parsed as
not((P or Q) = (not P)) and (not Q)
. Now not((P or Q) = (not P)) evaluates to true (because (P or Q) is not the same thing as (not P)), so the result is (not Q). In order to get what you want, you need more parentheses:
> (not(P and Q)) = ((not P) or (not Q));
(not (P and Q)) = (not (P and Q))
> (not(P or Q)) = ((not P) and (not Q));
(not (P and Q)) = (not (P and Q)) However, Maple's simplification of expressions involving these operators is not always complete. For example:
> (not(P and not Q)) = ((not P) or Q);
(not (P and not Q)) = (not P or Q) If you want to do boolean logic with Maple, I think it's better to use the Logic package.
The logical operators (not, and, or) all have lower binding strength than =. This means that your
not(P or Q) = (not P) and (not Q) 
is actually parsed as
not((P or Q) = (not P)) and (not Q)
. Now not((P or Q) = (not P)) evaluates to true (because (P or Q) is not the same thing as (not P)), so the result is (not Q). In order to get what you want, you need more parentheses:
> (not(P and Q)) = ((not P) or (not Q));
(not (P and Q)) = (not (P and Q))
> (not(P or Q)) = ((not P) and (not Q));
(not (P and Q)) = (not (P and Q)) However, Maple's simplification of expressions involving these operators is not always complete. For example:
> (not(P and not Q)) = ((not P) or Q);
(not (P and not Q)) = (not P or Q) If you want to do boolean logic with Maple, I think it's better to use the Logic package.
The most likely numerical method that you could implement by yourself in C++ would be a multivariate Newton's method. That's basically what fsolve is doing in your example, taking just 6 iterations to converge sufficiently.
Another problem with this is that there may be solutions that contain I's but turn out to be real. For example, try the cubic equation x^3 - 3*x + 1 = 0
Another problem with this is that there may be solutions that contain I's but turn out to be real. For example, try the cubic equation x^3 - 3*x + 1 = 0
It looks like you used pi instead of Pi.
It looks like you used pi instead of Pi.
Rescaling your variable "lam" seems to fix the problem:
> V:= Qmess(10^(-7)*u,.5e-7):
  NLPSolve(V, u = 4.50 .. 7.00, maximize);
[15.0562412931820795, [u = 5.32601129024012821]]
> NLPSolve(V, u = 5.20 .. 5.45, maximize);
[15.0562412931820759, [u = 5.32601129458431721]] Presumably the solver stops once the location of the maximum has been narrowed down to within a certain tolerance.
I also get [1], both in Maple 10 and Maple 11. There's something strange going on, maybe somewhere else in your worksheet. Could you upload a complete worksheet where you execute this command and get []?
I also get [1], both in Maple 10 and Maple 11. There's something strange going on, maybe somewhere else in your worksheet. Could you upload a complete worksheet where you execute this command and get []?
Maple will do the Cauchy principal value if you ask it to:
> int(1/(1+a*y)/sqrt(1-y^2),y=0..1,CauchyPrincipalValue)
     assuming a < -1;
1/(-1+a^2)^(1/2)*Re(arctanh(a/(-1+a^2)^(1/2)))
> simplify(evalc(%));
1/2*(ln(-(-1+a^2)^(1/2)-a)-ln(-a+(-1+a^2)^(1/2))) /(-1+a^2)^(1/2) I don't know why it doesn't work for the original integral:
> int(1/(1+a*cos(x)),x=0..Pi/2,CauchyPrincipalValue) 
     assuming a < -1;
int(1/(1+a*cos(x)),x = 0 .. 1/2*Pi,CauchyPrincipalValue)
Maple will do the Cauchy principal value if you ask it to:
> int(1/(1+a*y)/sqrt(1-y^2),y=0..1,CauchyPrincipalValue)
     assuming a < -1;
1/(-1+a^2)^(1/2)*Re(arctanh(a/(-1+a^2)^(1/2)))
> simplify(evalc(%));
1/2*(ln(-(-1+a^2)^(1/2)-a)-ln(-a+(-1+a^2)^(1/2))) /(-1+a^2)^(1/2) I don't know why it doesn't work for the original integral:
> int(1/(1+a*cos(x)),x=0..Pi/2,CauchyPrincipalValue) 
     assuming a < -1;
int(1/(1+a*cos(x)),x = 0 .. 1/2*Pi,CauchyPrincipalValue)
First 172 173 174 175 176 177 178 Last Page 174 of 187