Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are replies submitted by Robert Israel

To find the inverse of x mod y, where x is in cell A1 and y in A2:
=Maple("1/&1 mod &2",A1,A2)
This is strange. I opened your file 7265_upload3.mw with Maple 11.02 (Standard GUI) under Windows XP, executed the commands there, and I did get the detailed Matrix command. Well, an alternative is to use the ImportMatrix command rather than the ImportData assistant. For example,
> A = ImportMatrix("myfile.csv",source=csv);
This is strange. I opened your file 7265_upload3.mw with Maple 11.02 (Standard GUI) under Windows XP, executed the commands there, and I did get the detailed Matrix command. Well, an alternative is to use the ImportMatrix command rather than the ImportData assistant. For example,
> A = ImportMatrix("myfile.csv",source=csv);
I don't know why Georgios wanted to mess about with conversion to matrix, but I think it's beside the point. The A := ... statement in Evan's document seems to be rather fragile. It works for me if I download and open the worksheet as is, but it doesn't work if I try a restart and execute the commands again. It would have been better to have a Matrix command (in 1D input rather than 2D) with the matrix elements themselves visible, like this (which I obtained with the help of printf("%a",A)).
> A:= Matrix(100, 2, [[-.498e-1,0],[-.488e-1,.4],[-.478e-1,.2],[-.468e-1,.4],
[-.458e-1,.4],[-.448e-1,.4],[-.438e-1,.4],[-.428e-1,.6],
[-.418e-1,.2],[-.408e-1,.4],[-.398e-1,.6],[-.388e-1,.8],
[-.378e-1,.4],[-.368e-1,.6],[-.358e-1,1],[-.348e-1,1],
[-.338e-1,1],[-.328e-1,1.2],[-.318e-1,1.4],[-.308e-1,1.4],
[-.298e-1,1.4],[-.288e-1,1.8],[-.278e-1,1.6],[-.268e-1,2.4],
[-.258e-1,2.4],[-.248e-1,2.2],[-.238e-1,3],[-.228e-1,2.6],
[-.218e-1,3.2],[-.208e-1,3],[-.198e-1,3.6],[-.188e-1,3.6],
[-.178e-1,3.6],[-.168e-1,3.6],[-.158e-1,4.2],[-.148e-1,4],
[-.138e-1,4],[-.128e-1,4.4],[-.118e-1,4.4],[-.108e-1,4.4],
[-.98e-2,4.2],[-.88e-2,4.6],[-.78e-2,4.2],[-.68e-2,4],
[-.58e-2,3.8],[-.48e-2,3.6],[-.38e-2,3],[-.28e-2,3],
[-.18e-2,2.6],[-.8e-3,2],[.2e-3,1.8],[.12e-2,1.6],
[.22e-2,1.2],[.32e-2,.8],[.42e-2,.2],[.52e-2,0],[.62e-2,0],
[.72e-2,-1],[.82e-2,-1],[.92e-2,-2],[.102e-1,-2],
[.112e-1,-2.2],[.122e-1,-3.2],[.132e-1,-3.6],[.142e-1,-3.8],
[.152e-1,-4.2],[.162e-1,-4.2],[.172e-1,-4.6],[.182e-1,-4.8],
[.192e-1,-5.2],[.202e-1,-5.2],[.212e-1,-5.4],[.222e-1,-5.2],
[.232e-1,-5.4],[.242e-1,-5],[.252e-1,-5],[.262e-1,-4.8],
[.272e-1,-4.2],[.282e-1,-3.8],[.292e-1,-3.6],[.302e-1,-3],
[.312e-1,-2.4],[.322e-1,-2],[.332e-1,-2],[.342e-1,-1.8],
[.352e-1,-1],[.362e-1,-1.2],[.372e-1,-1],[.382e-1,-1.2],
[.392e-1,-.6],[.402e-1,-.8],[.412e-1,-.6],[.422e-1,-.4],
[.432e-1,-.4],[.442e-1,-.2],[.452e-1,-.2],[.462e-1,-.4],
[.472e-1,-.2],[.482e-1,-.4],[.492e-1,-.6]]);
Anyway, to plot the points with the x values all shifted right by 1, you can use this:
> with(plots):
  B:= A + <(<1|0>$100)>:
  pointplot(B);
Or if you prefer to use ScatterPlot, it could be done this way:
> with(LinearAlgebra):
  ScatterPlot(Column(B,1),Column(B,2));
I don't know why Georgios wanted to mess about with conversion to matrix, but I think it's beside the point. The A := ... statement in Evan's document seems to be rather fragile. It works for me if I download and open the worksheet as is, but it doesn't work if I try a restart and execute the commands again. It would have been better to have a Matrix command (in 1D input rather than 2D) with the matrix elements themselves visible, like this (which I obtained with the help of printf("%a",A)).
> A:= Matrix(100, 2, [[-.498e-1,0],[-.488e-1,.4],[-.478e-1,.2],[-.468e-1,.4],
[-.458e-1,.4],[-.448e-1,.4],[-.438e-1,.4],[-.428e-1,.6],
[-.418e-1,.2],[-.408e-1,.4],[-.398e-1,.6],[-.388e-1,.8],
[-.378e-1,.4],[-.368e-1,.6],[-.358e-1,1],[-.348e-1,1],
[-.338e-1,1],[-.328e-1,1.2],[-.318e-1,1.4],[-.308e-1,1.4],
[-.298e-1,1.4],[-.288e-1,1.8],[-.278e-1,1.6],[-.268e-1,2.4],
[-.258e-1,2.4],[-.248e-1,2.2],[-.238e-1,3],[-.228e-1,2.6],
[-.218e-1,3.2],[-.208e-1,3],[-.198e-1,3.6],[-.188e-1,3.6],
[-.178e-1,3.6],[-.168e-1,3.6],[-.158e-1,4.2],[-.148e-1,4],
[-.138e-1,4],[-.128e-1,4.4],[-.118e-1,4.4],[-.108e-1,4.4],
[-.98e-2,4.2],[-.88e-2,4.6],[-.78e-2,4.2],[-.68e-2,4],
[-.58e-2,3.8],[-.48e-2,3.6],[-.38e-2,3],[-.28e-2,3],
[-.18e-2,2.6],[-.8e-3,2],[.2e-3,1.8],[.12e-2,1.6],
[.22e-2,1.2],[.32e-2,.8],[.42e-2,.2],[.52e-2,0],[.62e-2,0],
[.72e-2,-1],[.82e-2,-1],[.92e-2,-2],[.102e-1,-2],
[.112e-1,-2.2],[.122e-1,-3.2],[.132e-1,-3.6],[.142e-1,-3.8],
[.152e-1,-4.2],[.162e-1,-4.2],[.172e-1,-4.6],[.182e-1,-4.8],
[.192e-1,-5.2],[.202e-1,-5.2],[.212e-1,-5.4],[.222e-1,-5.2],
[.232e-1,-5.4],[.242e-1,-5],[.252e-1,-5],[.262e-1,-4.8],
[.272e-1,-4.2],[.282e-1,-3.8],[.292e-1,-3.6],[.302e-1,-3],
[.312e-1,-2.4],[.322e-1,-2],[.332e-1,-2],[.342e-1,-1.8],
[.352e-1,-1],[.362e-1,-1.2],[.372e-1,-1],[.382e-1,-1.2],
[.392e-1,-.6],[.402e-1,-.8],[.412e-1,-.6],[.422e-1,-.4],
[.432e-1,-.4],[.442e-1,-.2],[.452e-1,-.2],[.462e-1,-.4],
[.472e-1,-.2],[.482e-1,-.4],[.492e-1,-.6]]);
Anyway, to plot the points with the x values all shifted right by 1, you can use this:
> with(plots):
  B:= A + <(<1|0>$100)>:
  pointplot(B);
Or if you prefer to use ScatterPlot, it could be done this way:
> with(LinearAlgebra):
  ScatterPlot(Column(B,1),Column(B,2));
You could get Maple to do it the tricky way:
> J := Int(sqrt(sin(x))/(sqrt(sin(x))+sqrt(cos(x))),x=0..Pi/2);
  Jtoo:= student[changevar](x=Pi/2-t,J,t);
  combine(J+subs(t=x,Jtoo))/2;
  value(%);
Pi/4
I'm puzzled by your question "Is it possible to animate a cone with the plane rotated?", because that's exactly what my code produces. To start the animation, you click on the plot and press the Play button (the triangle pointing to the right) in the tool bar.
I'm puzzled by your question "Is it possible to animate a cone with the plane rotated?", because that's exactly what my code produces. To start the animation, you click on the plot and press the Play button (the triangle pointing to the right) in the tool bar.
What makes this solvable in closed form is that sqrt(2)-1 = 1/(sqrt(2)+1). Of course, Maple fails to see that...
> _EnvAllSolutions:= true:
  eq:= (sqrt(2)+1)^x + (sqrt(2)-1)^x = 3:
  eval(convert(eq,exp),sqrt(2)-1=1/(sqrt(2)+1));
exp(ln(2^(1/2)+1)*x)+exp(-ln(2^(1/2)+1)*x) = 3
> solve(%);
(ln(3/2+1/2*5^(1/2))+2*I*Pi*_Z1)/ln(2^(1/2)+1), (ln(3/2-1/2*5^(1/2))+2*I*Pi*_Z1)/ln(2^(1/2)+1)
> evalf(subs(_Z1=0,[%]));
(to get the real solutions) [1.091958806, -1.091958804]
... and note that the result is not cos(3 x). As I mentioned, the functions cos(n x) are not orthogonal on [0, Pi/2]. If you want a Fourier cosine series on [0,Pi/2], the basis functions are cos(2 n x). The corresponding series for cos(3 x) is -2/(3*Pi)+12/Pi*sum((-1)^n/(4*n^2-9)*cos(2*n*x),n=1..infinity);
... and note that the result is not cos(3 x). As I mentioned, the functions cos(n x) are not orthogonal on [0, Pi/2]. If you want a Fourier cosine series on [0,Pi/2], the basis functions are cos(2 n x). The corresponding series for cos(3 x) is -2/(3*Pi)+12/Pi*sum((-1)^n/(4*n^2-9)*cos(2*n*x),n=1..infinity);
1) It would probably be better to use LinearAlgebra and the new (as of Maple 11) GraphTheory package rather than the old networks and linalg packages. In particular, networks[draw] does not indicate the direction of directed edges, while GraphTheory[DrawGraph] does. GraphTheory also has lots of other neat stuff. 2) That's Maple 10, not Maple V.10. Maple V refers to the versions of Maple that came after Maple IV and before Maple 6 (they decided at that point to quit using Roman numerals).
Unfortunately isolve doesn't allow inequalities, so to specify that numbers of coins must be nonnegative you do need LPSolve. In general, this is a kind of knapsack problem, and NP-complete.
No, Maple doesn't think. It's important to remember that, for all its awesome capabilities, Maple has no more intelligence than an earthworm. It just mindlessly carries out the command you give it. This can be especially frustrating when what you wrote isn't what you meant: Maple does not read minds. As Georgios mentioned, evalb(A=B) does not do any simplification at all, and just checks whether A and B are syntactically equal. Note also that you're more likely to discover that A=B by simplifying A-B = 0 than by simplifying A=B. I'd recommend looking at the result of simplify before applying evalb, to see how much simplification is actually being done. In some cases, you might need to use expand, collect, factor, etc.
> simplify(tan(x)^3 - sin(x)^3/cos(x)^3 = 0);
0 = 0
The best that can be done, I think, is this. Expand out your square and integrate. The result will be sum(sum(F(x[i],x[j],d) - F(x[i],x[j],c),j=1..k),i=1..k) + sum(sum(F(y[i],y[j],d) - F(y[i],y[j],c),j=1..n),i=1..n) - 2*sum(sum(F(x[i],y[j],d)-F(x[i],y[j],c),j=1..n),i=1..k) where F(x,y,b) is the following:
> int((x-b)*(y-b)*exp(((x-b)^2+(y-b)^2)/2/sigma^2),b);
With a little fiddling, this simplifies to sigma^2*(2*b-x-y)/4*exp(((x-b)^2+(y-b)^2)/(2*sigma^2))-sqrt(Pi) *sigma/8*((x-y)^2+2*sigma^2)*erfi((2*b-x-y)/2/sigma)*exp((x-y)^2/4/sigma^2) You may prefer to write F(x,y,b) = sigma^3*G((x-b)/sigma, (y-b)/sigma) where G(X,Y) = 1/8*Pi^(1/2)*((X-Y)^2+2)*exp(1/4*(X-Y)^2)*erfi(1/2*X+1/2*Y)-1/4*(X+Y)*exp(1/2*X^2+1/2*Y^2)
First 158 159 160 161 162 163 164 Last Page 160 of 187