acer

32303 Reputation

29 Badges

19 years, 310 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The equations are not all linear in those variables.

> eqnlist := Equate(
>   <(1/5)*sqrt(6)*c[3,1]+(1/7)*sqrt(6)*c[3, 3], 0,
>     (2/7)*c[3, 3]*c[3, 1]+(2/9)*c[3, 3]^2>,
>   <0,0,1>
>                   ):

> fsolve({eqnlist[1],eqnlist[3]},{c[3, 1],c[3, 3]});
                {c[3, 1] = 5.303300866, c[3, 3] = -7.424621212}
 
> _EnvExplicit:=true:

> solve(eqnlist,[c[3, 1],c[3, 3]],AllSolutions);
                  1/2                1/2
              15 2               21 2
[[c[3, 1] = - -------, c[3, 3] = -------],
                 4                  4
 
                   1/2                  1/2
               15 2                 21 2
    [c[3, 1] = -------, c[3, 3] = - -------]]
                  4                    4
 
> evalf(%);
[[c[3, 1] = -5.303300858, c[3, 3] = 7.424621200],
 
    [c[3, 1] = 5.303300858, c[3, 3] = -7.424621200]]

acer

First case: a is a Matrix/Vector/Array (ie. and rtable underneath). In that case, square brackets are the "usual" indexing way, and round brackets allows some new indexing facility introduced in Maple 12. See the first item in the ?updates,Maple12,programming help-page. I personally would prefer to use the square brackets, unless I were using the new functionality to extend the size of the rtable dynamically or to get some (no-copy) efficiency with it on the rhs of an assignment. People familiar with Maple would recognize the square bracket code as "indexing". Which you prefer might depend on how much you wish to kowtow to Matlab syntax.

While I understand that using round brackets for rtable indexing (new in Maple 12) has appeal, I'm not sure yet whether I like the choice of syntax. Efficiency is good, and so is the new ability to extend sizes dynamically. But those could be gotten with other syntax choices too. The choice of round brackets is "Matlab compatible", but it also precludes the possibility of extending round-bracket syntax to allow application by, say, a Matrix of operators.

Second case: a is not an rtable. In that case using the square brackets will treat a as a table, even if you have not used the table() command explicitly. For example,

> restart:
> a[5]:=17:
> a[5];
                                      17
> eval(a);
                                table([5 = 17])

If you instead use the round brackets, then you are using function application syntax. And when you use it in an assignment like that, you are assigning to the remember table of "function" a. Now, while that does also use a table underneath as the mechanism, it is less apparent what's going on. People may not recognize immediately what your code is doing and how it relies on this, even if the overall effect is the same. I would prefer square brackets, in this case.

> restart:
> a(5):=17:
> a(5);
                                      17
> eval(a);
               proc() option remember; 'procname(args)' end proc
 
> op(4,eval(a));
                                table([5 = 17])

acer

> seq([eval(c^6*d,x),x], x in solve({6*c+d=24,6*c^2+d^2=96},[c,d]));
             3072000000
            [----------, [c = 20/7, d = 48/7]], [0, [c = 4, d = 0]]
               823543

> map2(op,1,[%]);
                                 3072000000
                                [----------, 0]
                                   823543

> max(%);
                                  3072000000
                                  ----------
                                    823543

Or, simply,

> max(seq(eval(c^6*d,x), x in solve({6*c+d=24,6*c^2+d^2=96},[c,d])));
                                  3072000000
                                  ----------
                                    823543

acer

[deleted something silly]

You could arrange numbers in a heap according to size.

> h := heap[new](`<`, 4, 7, 19, 111, 2):

> heap[insert](17, h):

> while not heap[empty](h) do heap[extract](h); end do;
                                      111

                                      19

                                      17

                                       7

                                       4

                                       2

As for extracting them to a list, I presume that you want the list sorted (by the same boolean-valued function used by the heap). Note that, for a heap h stored in a table according to the scheme above, the element h[0] is the number of stored values while the element h[`<`] is the boolean valued function which compares/sorts them.

> h := heap[new](`>`, 4, 7, 19, 111, 2):
> sort([seq(h[i],i=1..h[0])],h[`<`]);
                              [111, 19, 7, 4, 2]

> h := (heap[new])(lexorder, greg, tony, bruno, michael):
> sort([seq(h[i],i=1..h[0])],h[`<`]);
                         [bruno, greg, michael, tony]

See here for some nice notes on efficient sorting of lists.

note: This stuff above involves heaps implemented as Maple tables. You also wrote that you wanted to implement a heap as a list. Do you really want to do that, as well, even though Maple lists are not efficient mutable data structures?

acer

I'm not really sure what you're trying to get.

> X := `<,>`(1, 2, 3):

> T := proc () K[1] end proc:

> S := proc (X::evaln) subs(K = ''X'', eval(T)) end proc:

> g:=S(X);
                          g := proc() 'X'[1] end proc

> g();
                                     X[1]

What is the "more complex case", and what do you wish for it?

acer

This seemed OK for me, in Maple 12.01 (on Linux). I didn't see quotes around the name, as with the typeset() solution.

Z:=(x,y,t)->plots[textplot]([x, y, Typesetting:-mover(Typesetting:-mi(convert(t,string)),Typesetting:-mo("→"))]):

Z(1,1,P);

The arrow symbol that you see there is actually "&rarr;" in case you wanted to type it in rather than cut 'n paste from here.

For some reason the above procedure (itself, its own body, not its output) would not print in the Standard GUI. That's a bug, but it shouldn't prevent one from actually using the procedure.

acer

Why not send the Matrix in as one of the arguments, have the procedure act on it "in-place". After it runs, the Matrix will have been updated by this process. The procedure could, say, return NULL.

acer

What is the characteristic equation here? Is it not r^2-b*r=0 where b=1? If so, then it has roots of 1 and 0. Your series is not stationary, but its first difference should be (because the only other root is 0). And if you take the difference s[i]-s[i-1] then you get just randd[i] which is from the normal sample itself. And you find that first difference to be stationary. Ok, fine.

I don't understand what the P() refers to, when you talk of "increasing the return". Also, you seem to have made two posts, the first which claims that you did not detect autocorrelation after the differencing s[i]-s[i-1], and the second which claims that you did. Could you explain that with more detail, and your expectation, please?

acer

What progress have you gotten with this so far?

What do you know about the RSA scheme? Can you write it out here, so that we know that you understand it? What variable's value(s) are you searching for, in it? What mathematical techniques do you think that you'll need to understand, to answer it? (Will it it be anything like those needed for this, or not?)

What number range and layout are you using for the alphabet of 95 printable ASCII characters (space=32 and tilde=126?)?

acer

> f := n -> Matrix(n+1,n+1,scan=band[1,1],[[a$n],[b$(n+1)],[c$n]]):

> f(4);
                            [b    c    0    0    0]
                            [                     ]
                            [a    b    c    0    0]
                            [                     ]
                            [0    a    b    c    0]
                            [                     ]
                            [0    0    a    b    c]
                            [                     ]
                            [0    0    0    a    b]


> subs([a=sin(x),b=cos(x),c=x^2],f(4));
               [             2                                ]
               [cos(x)      x         0         0         0   ]
               [                                              ]
               [                       2                      ]
               [sin(x)    cos(x)      x         0         0   ]
               [                                              ]
               [                                 2            ]
               [  0       sin(x)    cos(x)      x         0   ]
               [                                              ]
               [                                           2  ]
               [  0         0       sin(x)    cos(x)      x   ]
               [                                              ]
               [  0         0         0       sin(x)    cos(x)]

> (a,b,c):=sin(x),cos(x),x^2:
> f(4);
               [             2                                ]
               [cos(x)      x         0         0         0   ]
               [                                              ]
               [                       2                      ]
               [sin(x)    cos(x)      x         0         0   ]
               [                                              ]
               [                                 2            ]
               [  0       sin(x)    cos(x)      x         0   ]
               [                                              ]
               [                                           2  ]
               [  0         0       sin(x)    cos(x)      x   ]
               [                                              ]
               [  0         0         0       sin(x)    cos(x)]

acer

Does this get what you're after?

v:=t->Vector(3,{1=t^2,2=3*t,3=t^3}):
a := unapply( map(diff,v(t),t), t):
a(5)

acer

You mentioned that a1, b1, ..., a8, b8 are between 1e-2 to 1e-13, which are floating-point. But otherwise, you seem to be angling for an exact result (if possible, though it would be huge, and, what would one do with it...?).

So my question is, do you want an exact symbolic result or a floating-point approximation (for some stated values of a1,b,..a8,b8)?

acer

The string was not transcribed correctly, in the OP's post. It should probably be something more like,

S:="#fM2{Sz{\
&fg{Z22 &{,_32zU{&Y2{r~_%_92{%u$z?TT+{_& 2%{92{f?{J{Y_%{%2yf`Y2z2%{3\
Y2{9_F@&yzf`3{ZYfyY{Y_%{3Y2{3z_F&9@3_3fSF{`zSy2%@z2o{J{3S,%{Y2z{3Y_3{J{\
Y_%o{n>f3YS@3{3Y2{ 2tU{&fzU{2gy@&2{92{f?{J{l2,f2M2{3Y2{3YfFL{f9`S&&fl,2o{n\
jS{tS@{Zf&Y{92{3S{F_92{tS@z{ 2tU{9_%_92){nJ?{tS@{`,2_&2on{J{3Y2F{3S,%{Y2z{\
3Y2{ 2tbZSz%U{ZYfyY{l2,SFL&{3S{FS{,_FL@_L2U{_F%{J{&_Z{Y2z{&@z`zf&2o{kY2{\
3S,%{92{3Y_3{f3{Z_&{f9`S&&fl,2U{?Sz{&Y2{l2,f2M2%{Y2z&2,?{3Y2{SF,t{`S&&2\
&&Sz{S?{3Y_3{ZSz%{ZYfyY{&Y2{ 2`3{fF{Y2z{929Szt{_F%{ZYfyY{&Y2{Y_%{F2M2z{Z\
zf332F{%SZFo{J{yS@,%{Y_M2{3S,%{Y2z{3Y2{3z@3Y{bb{3Y_3{3Y2{&_92{y_,y@,_3f\
SF{ZYfyY{Y_%{&2zM2%{92{?Sz{%2yf`Y2zfFL{3Y2{9_F@&yzf`3{Y_%{2F_l,2%{92{3S\
{,2_zF{3Y2{ZSz%{bb{l@3{SF{_{y_`zfy2{f3{&3z@y {92{3S{32,,{Y2z{3Y_3{_{L2Ff\
2{Y_%{z2M2_,2%{f3{3S{92o{xYf&{?_,&2{%f&y,S&@z2{?2332z2%{~_%_92{%u$z?TT{\
3S{92o{xY_3{%_t{J{l2y_92{3Y2{9_&32z{S?{Y2z{&S@,U{_F%{J{_l@&2%{9t{`SZ2zo\
{wM2zt{3f92{J{3YfF {S?{f3U{J{_9{%f&3z2&&2%{_F%{_&Y_92%U{_F%{J{%S{`2F_Fy2\
{FSZ{fF{3Y2{Sl,fL_3fSF{@F%2z{ZYfyY{J{`,_y2{9t&2,?{S?{32,,fFL{3Y2{3z@3Y{\
fF{Zzf3fFL{9t{929Sfz&o":

It looks like a fragment by Giacomo Casanova (which would be fitting, for a cipher). I don't see how it's helpful to consider it as an affine cipher, without knowing the alphabet in use. The character set of the enciphered message is not the usual alphabet (as claimed by the OP).

Five or six weeks later, she [Madame D'Urfe'] asked me if I had
deciphered the manuscript which had the transmutation procedure.
I told her that I had.

"Without the key, sir, excuse me if I believe the thing
impossible."

"Do you wish me to name your key, madame?"

"If you please."

I then told her the word, which belongs to no language, and I
saw her surprise. She told me that it was impossible, for she
believed herself the only possessor of that word which she kept
in her memory and which she had never written down.

I could have told her the truth -- that the same calculation
which had served me for deciphering the manuscript had enabled
me to learn the word -- but on a caprice it struck me to tell
her that a genie had revealed it to me. This false disclosure
fettered Madame d'Urfe' to me. That day I became the master of
her soul, and I abused my power. Every time I think of it, I am 
distressed and ashamed, and I do penance now in the obligation
under which I place myself of telling the truth in writing my
memoirs.

acer

It should be possible to write an iterative procedure to do this (when a solution exists) for numeric input (similar to methods for discrete Lyapunov or Stein equations).

[ref] Kitagawa: An Algorithm for Solving the Matrix Equation X = F X F' + S, International Journal of Control, Vol. 25, No. 5, p745–753 (1977).

Whether this is necessary or advisable may depend on whether you have exact or approximate floating-point data to solve (and the dimensions).

acer

First 306 307 308 309 310 311 312 Last Page 308 of 336