acer

32470 Reputation

29 Badges

20 years, 6 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by 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 "→" 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

Maybe you could create a Matrix inside the procedure get_quantities, instead of a table like q1, and then have that procedure assign directly to the entries of that Matrix, and have that routine also return that Matrix? Ie, right at the beginning of the procedure, insert a line like the following, and leave the rest as it is.

q1 := Matrix(4,4);

Having done it your original way, can you get the conversion of table q1 to a 4x4 Matrix like so, assuming q1's indices are valid?

Matrix(4,4,{op(map(op@lhs=rhs, op(eval(q1))))});

acer

> Optimization:-Maximize( diff(2*Pi*(x+1)*(ln(sqrt(x)+1)),x$4), x=0..10 );
              [0.0427548197437215699, [x = 2.75891892689316043]]

acer

Use := instead of = to assign a value to a variable. Eg, x:=3

acer

ko:=2*Pi/v*f;v:=2.998*10^8;f:=2.525*10^9:
Lo:=29.379;Wo:=34.477:

evalf(1/(120*Pi^2)*Int(eval((sin(ko*W/2*cos(theta))
  /cos(theta))^2*sin(theta)^3
  *BesselJ(0,ko*L*sin(theta)),
                            [L=Lo,W=Wo]),
                       theta=0..Pi,
                       'method'='_d01akc'));

I got a result of -0.01815483673 in 50sec or so, using default precision and error tolerance.

It may be that you could speed it up by using a faster J0, see here for some idea on that.

acer

At least in some cases (eg. no method specified) it seems that `evalf/int` is using all that time and memory just getting started. I have not looked into it, but I suspect that it is either expanding the expression for the integrand or going to a lot of trouble investigating its possible singularities.

One way to prevent this might be to instead supply the integrand in procedure form. For example,

> kernelopts(printbytes=false):
>
> expr := (700.*(8.54845000761408*10^(-14)+1.89764579559636*10^(-20)*x
>   -7.30287375722720*10^(-15)*sqrt(-4.88741578151207-0.117848792714772e-5*x
>   +5.88741696*(7.0875263*10^(-8)*x+.999999929124737)^2)
>   -7.30287375722720*10^(-15)*sqrt(-4.88740033154292-0.166284570377619e-4*x
>   +5.88741696*(0.1000049503e-5*x+.999998999950497)^2)))*(0.1000049503e-5*x
>   +.999998999950497)^699:
>
> infolevel[`evalf/int`]:=1:
>
> p := (igrand,var,eps,dig) ->
>          evalf(Int(unapply(igrand,var),0..1,
>                ':-epsilon'=eps,':-digits'=dig)):
>
> (st,ba):=time(),kernelopts(bytesalloc):
> p(expr,x,5e-48,50);

evalf/int/quadexp:   "applying double-exponential method"
From quadexp, result = .49597789486775255522822143063830103993131048383834929e\
-10   integrand evals = 251
error = .67577561574848300181818879875801379481549548196653190e-51
                                                                 -10
          0.49597789486775255522822143063830103993131048383835 10
 
> time()-st,kernelopts(bytesalloc)-ba;
                                0.133, 4586680
 
>
> (st,ba):=time(),kernelopts(bytesalloc):
> p(expr,x,5e-999,1000);

evalf/int/quadexp:   "applying double-exponential method"
From quadexp, result = .495977894867752555228221430638301039931310492022899466\
644863155892848792957698316173663416356289280340905183621150933083273451751150\
688422251537570640162013777422635304107239944450854442949767766202422446813541\
291842170676719302147344953018224571852568056425318369349620141132215664822215\
819287624610431244975489292421620589776615490634158715997539524368315885124846\
153868928963307985971934432936330690528228760948143732704933423546808015212843\
065059133506284234900991409770961781215958171389339091813958975665245259554991\
181406210188106754305841450043143640081874455867725359231876948238091718080644\
231647469827063510487344935299299152255130074981136941456133991963011948044995\
829920234596881886237877233743689759617015486304687740377240361926300875357677\
049754829216907385465518935029639003669159179549426024797385784517069670593408\
967451285579119784282997998255078239510298598777672271590769801905513044439130\
719274573082826119220723147476362297182784530976883370888472407370292016105096\
461010654172468e-10   integrand evals = 8191   error = .1068957763222413909290\
828331581885717950307856444575520792184164009774485992862378877061120684652068\
714145198449315644786112745330862670544704617614956186071965227208091156796992\
256598099347440766070207316614597873130731815998688007568359515194511680633176\
396158809188160122103800317522749656609284273976702105353889250453265858917615\
486718998884574997644271626928718028210940547954748026592216995188832704352515\
979352254760364928590099305101723248523293242587788666434766509931861178185114\
847526054524146290792220280179815449593112497516125009690794504185125187551950\
088621959082874712868649577856815778879385492925898730268912091565390712055242\
330338275797393922906922143071412442829077625378206709586863625907087434233770\
070603377405265805862337264135543276582539463159570394335875648239786455475575\
619505354210999282781782450683806487521491218373429892166139026584437340700477\
878225633094049331656000341766679459768696159800547988877948596749307806759845\
79938998234766655481151608564670377169577799486e-1002

0.4959778948677525552282214306383010399313104920228994666448631558928487929\
    57698316173663416356289280340905183621150933083273451751150688422251537\
    57064016201377742263530410723994445085444294976776620242244681354129184\
    21706767193021473449530182245718525680564253183693496201411322156648222\
    15819287624610431244975489292421620589776615490634158715997539524368315\
    88512484615386892896330798597193443293633069052822876094814373270493342\
    35468080152128430650591335062842349009914097709617812159581713893390918\
    13958975665245259554991181406210188106754305841450043143640081874455867\
    72535923187694823809171808064423164746982706351048734493529929915225513\
    00749811369414561339919630119480449958299202345968818862378772337436897\
    59617015486304687740377240361926300875357677049754829216907385465518935\
    02963900366915917954942602479738578451706967059340896745128557911978428\
    29979982550782395102985987776722715907698019055130444391307192745730828\
    26119220723147476362297182784530976883370888472407370292016105096461010\
 
           -10
    6542 10
 
> time()-st,kernelopts(bytesalloc)-ba;
                                20.330, 6421352

You wouldn't necessarily need to create a procedure like p above. I just did that to make it easier to try various values. The key bit was unapplying expr with respect to variable x.

You might also wish to control the epsilon and digits optional parameters separately.

I notice that when specified to use 50 digits of working precision it claims that the resulting error estimate is something like 10^(-51). But only 44 digits or so of that result computed at digits=50 agree with the second result computed at digits=100. Hence you may wish to consider the error estimate (printed as userinfo messages) with circumspection, especially from the computation done at the highest choice of the digits parameter. You may be safer instead doing a pair of computations, like above, and accepting only the digits that agree.

acer

Are you allowed to use the StringTools package? Its routines Rotate and CharacterMap can make the application of a candidate solution simple.

S:="fsqFsHn sGGousG":

ABET:="ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz":

Now find the i such that this routine produces the decrypted message.

f := (i,abet,s) -> StringTools:-CharacterMap(
                         StringTools:-Rotate(abet,i),abet,s);

acer

First 308 309 310 311 312 313 314 Last Page 310 of 337