Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 353 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

You can convert the arrows, or anything else, to Cartesian coordinates, and put them on a polar plot like this:

 

N:= 12:

magnitude:= RandomTools:-Generate(list(float(range= 0..1, method= uniform), N)):

phase:= RandomTools:-Generate(list(float(range= 0..360, method= uniform), N)):

A:= < < magnitude[] > | < phase[] > >:

ExcelTools:-Export(A, "C:/Users/Carl/desktop/data.xls"):

A:= convert(ExcelTools:-Import("C:/Users/Carl/desktop/data.xls"), Matrix):

Convert to radians:

A[.., 2]:= evalf(Pi)/180 *~ A[.., 2]:

Polar to Cartesian converter:

xy:= P-> < P[1]*cos(P[2]), P[1]*sin(P[2]) >:

p1:= plots:-arrow([seq](xy(A[k,..]), k= 1..N), shape= arrow, color= red):

Dummy plot to give us the polar background:

p2:= plots:-polarplot(1.1*max(A[.., 1]), color= white, transparency= 1):

plots:-display(p1,p2);


Download polarplot.mw

Use Sum (with a capital S), instead of sum, and you will get the answer that you expect.

I have no idea what that escaped variable _O and the rest of that huge mess represents. Surely the result of differentiating the lowercase sum is a bug. However, I will note that the fault lies with sum, not diff, because you get a nearly identical mess if you just do the derivative in your head and enter

sum(sin(theta[j](t))*cos(theta[j](t))*diff(theta[j](t), t), j= 1..i-1);

It looks like your Alphabet is shifted by one. I get "Y"=58, "e"=70, "s"=84. Regardless of that, the encryption steps are the same. The essential command is the inert modular exponentiation operator x &^ e mod n. I also did the decryption, partly for to verify the encryption and partly for my own amusement.

with(StringTools):
Alphabet:=cat(Select(IsPrintable,convert([seq(i,i=1..255)],bytes))):
AlphaToNum:= table([seq](Alphabet[k] = k, k= 1..length(Alphabet))):
plaintext:= "Yes":
NumText:= [seq](AlphaToNum[c], c in plaintext);
                          [58, 70, 84]
n, e:= 119, 7:
Crypted:= (c-> c &^ e mod n) ~ (NumText);
                         [114, 77, 84]
To decrypt:
f:= ifactor(n);
                            (7) (17)
phi:= expand(map(x-> x-1, f));
                               96
d:= 1/e mod phi;
                               55
Decrypted:= (c-> c &^ d mod n) ~ (Crypted);
                          [58, 70, 84]
cat(seq(Alphabet[k], k in Decrypted));
                             "Yes"

Save your file in Excel. I think as a CSV file would be best (Comma-Separated Values). Then in Maple, give the command ImportData(); and follow the dialog. Once you get that done, post a followup to this, and we can proceed with the plotting. Also post a followup if you have any trouble with the dialog.

mrmathexpert wrote:

How can I control the specific regions that I want to highlight? For example, from pi/2 to 3pi/2: outside or the left side of the y-axis bounded; and from 3pi/2 to pi/2, outside or the right side of the y-axis bounded.

You can do the left side and the right side separately, each side consisting of two polarplot commands, and paste all four together with display. I'm not sure if this is what you were trying to describe:

p1:= plots:-polarplot(2+cos(x), x= -Pi/2..Pi/2, color= red, filled= [color= yellow]):
p2:= plots:-polarplot(2+cos(x), x= Pi/2..3*Pi/2, color= red, filled= [color= white]):
p3:= plots:-polarplot(2, x= Pi/2..3*Pi/2, color= blue, filled= [color= yellow]):
p4:= plots:-polarplot(2, x= -Pi/2..Pi/2, color= blue, filled= [color= white]):
plots:-display([p4,p2,p3,p1]);

Download polarplot.mw

Note that the order of the plots in the display command matters: They are printed in the reverse of the order that they appear in the command. I don't think this is documented.

GraphTheory:-Graph vertices need to be integers, symbols, or strings; arbitrary expressions are not allowed. So 2, `*`, function, cos, y, and z are valid; but 2*y, 3*z, and cos(x+2*y) are not.

The command that you want is subsindets (or possibly evalindets). Here's an appropriate analogy: subsindets is to indets as applyop is to op.

I think you should collect like terms with respect to the integrals, like this

collect(eq2, Int);

so that each specific integrand only occurs once.

Tell me exactly which integrands you are trying to select. You said "like" phi[i](y)*diff(w(y), y). Do you mean exactly that integrand? Or would phi[i](y)*diff(w(y), y)^2 also count as "like"?

Once you answer that, I can give you a type specification that you can use with subsindets.

Assuming that those square brackets are really there (which I find a bit strange), the command is

(op@eval)(w1(x), op ~ ([sol]));

and likewise for w2(x).

If the square brackets are not actually there, then change (op@eval) to simply eval in the above command.

If the square brackets are really there, you should post the commands that got you to that point, because there may be something wrong.

There must have been a syntax change between Maple 13 and Maple 17 that I am not aware of. So sorry about this. Try this please: Make your first command

kernelopts(opaquemodules= false);

I am not sure that will work.

Joe Riel (or any expert who can answer): Was it once true that only module exports could be accessed with thismodule, but now locals can be accessed thus also? Also, were keyword parameters introduced after MAPLE 13?

 

restart;

macro(RV= Statistics:-RandomVariable, P= Statistics:-Probability, N= Normal):

x:= RV(N(6.05, sqrt(.0004/9))):

P(x < 6.035);

HFloat(0.01222447265504615)

Z:= RV(N(0,1)):

P(Z < -2.25);

HFloat(0.012224472655044694)

 

Download StatsZ.mw

Use < p > for handy Vector-to-Matrix conversion, and use ^%T for transpose.

KroneckerProduct(< p >, < p >^%T);

Your worksheet shows that you got an answer in slighly less than a minute. And I ran your code and got an answer in about 90 seconds.

In the Matlab, the upper bound of the inner loop is the index of the outer loop; whereas in the Maple, the two loops have the same upper bound. The closest matching Maple code to your Matlab is

for j from 1 to N do
    for i from irem(j-1,2) to j by 2 do
         Dhat[i+1,j+1]:= 2*j
   end do
end do;

You can also use (j-1) mod 2; I prefer irem in this case.

Before you can plot it, you need to deal with the six constants of integration _C1, ..., _C6. Can you find six initial or boundary conditions?

You should post your matrix or the worksheet that contains it. If the entries are rational functions, then we can compute the answer numerically over different finite fields and reconstruct the final answer via Chinese remaindering. A lot of this functionality is already built into Maple if you use the correct options for the Determinant command. And I'll work on that when you post your matrix.

In the worst case, there could be 14! ~ 87 billion terms in the determinant; so you may need to be satisfied with the value of the determinant at specific numeric values of the variables.

First 380 381 382 383 384 385 386 Last Page 382 of 395