acer

32303 Reputation

29 Badges

19 years, 309 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Start off with a character mapping that does nothing, and which maps abc...XYZ to itself. Make small changes to this, to get going with it. A single letter following an apostrophe is very likely an "s". The sequences "rWB" and "AWB" are likely "she" and "the", but you have to guess which. Single letter words are likely "a" or "I". Words of just two letters are likely "on", "in", "to", "of", "is", "be" or "at". If you're lucky then some of these easier short word guesses can be considered together. Just keep refining the mapping with guesses, and back out any guess that undoes something you're already confident about. Eventually you can guess whole words and thus deduce the remaining letters.

S := "wA'r aBeD WUeK AP XNaB NM U rALK\
NP USUeAJBMA NM zUM nPrB ZNAW U JUM ZW\
P'r XBUeMNMO AP SXUD AWB aNPXNM. yWUA'\
r ZWUA rWB APXK AWB SPXNCB ZWBM rWB WU\
MKBK AWBJ AWB BJSAD eBaPXaBe. lNCWUeK heULANOUM, yWB zCUeXUAAN yNXA";
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyz","abcdefghijklmnopqrstuvwxyz",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzA","abcdefghijklmnopqsstuvIxyzt",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAU","abcdefghijklmnopqsstuvIxyzta",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUP","abcdefghijklmnopqsstuvIxyztao",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMN","abcdefghijklmnopqsstuvIxyztaono",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMN","abcdefghijklmnopqsstuvIxyztaono",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMN","hbcdefghijklmeopqsstuvIxytttoeb",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMN","hbcdefghijklmeopqsstuvIxytthoeb",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWB","hbcdefghijklmeopqsstuvIxytthoebot",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWB","hbcdefghijklmeopqsstuvIxytthoebhe",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWB","hbcdefghijklmeopqsstuvIxstthoebhe",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWB","tbcdefghijklmeopqsstuvIxstthoebhe",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJ","tbcdefghijklmeopqsstuvIxstthoebhem",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJ","tbcdefghijklmeopqsstuvIxsttaoebhem",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJ","tbcdefghijklmeopqsstuvIxtttaoebhem",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJ","tbcdnfghijklmeopqsstuvIxtttaoebhem",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJ","tbcdefghijklmeopqsstuvIxtttaonohem",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJB","tbcdrfghijklmeopqsstuvIxtttaonoheme",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZ","tbcdrfghijklmeopqsstuvIxtttaonohemeb",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZK","tbcdrfghijklmeopqsstuvIxtttaonohemebd",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKX","tbcdrfghijklmeopqsstuvIxtttaonohemebde",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdrfghijklmeopqsstuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdmfghijklmeopqsstuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdrfghijklmeopqsstuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdmfghijklmeopqsstuvIxbttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdmfghijklmeopqssbuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdrfghijklmeopqssbuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdrfghijklmeopqIsbuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdrfghijklmeopqssbuvIxtttaonohemebdeyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdrfghijklmeopqssbuvIxtttaenohemebdeyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdofghijklmeopqssbuvIxtttaenohemebdeyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdrfghijklmeopqssbuvIxtttaenohemebdeyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXD","vbcdrfghijklmeopqssbuvIxtttaonohemebdey",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdrfghijklmeopqssbuvIxtttaonohemebdeyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDS","vbcdrfghijklmeopqssbuvIxtttaonohemebdlyp",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSO","vbcdrfghijklmeipqssbuvIxtttaonohemebdlypg",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSO","vbcdrfghijklmeopqssbuvIxtttaonghemebdlypg",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSO","vbcdrfghijklmeopqssbuvIxtttaonihemebdlypg",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtttaonihemebdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqsswuvIxtttaonihemebdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtttaonihemebdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtttaonihemewdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtntaonihemewdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtntaonihemewdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmeopqssbuvIxtstaonihemewdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOL","vbcdrfghijklmJopqssbuvIxtStaonihemewdlypgu",S);
StringTools:-CharacterMap("abcdefghijklmnopqrstuvwxyzAUPMNWBJBZKXDSOLC","vbcdrfghijklmJopqssbuvIxtStaonihemewdlypguc",S);

And finally, if you get bored, feed key bits of what you have into google (it's clearly a  quotation),

S := "wA'r aBeD WUeK AP XNaB NM U rALK\
NP USUeAJBMA NM zUM nPrB ZNAW U JUM ZW\
P'r XBUeMNMO AP SXUD AWB aNPXNM. yWUA'\
r ZWUA rWB APXK AWB SPXNCB ZWBM rWB WU\
MKBK AWBJ AWB BJSAD eBaPXaBe. lNCWUeK heULANOUM, yWB zCUeXUAAN yNXA";

StringTools:-CharacterMap("abcdefghijk\
lmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW\
XYZ","vbcdrfgBijkRmJopqssbuvIxTStecyEFGHImdunigoQRpTaVhlYw",S);
"It's very hard to live in a studio apartment in San Jose with a man who's \
    learning to play the violin. That's what she told the police when she h\
    anded them the empty revolver. Richard Brautigan, The Scarlatti Tilt"

acer

Right, there is a "lessthan" structure, but no "greaterthan" structure. You have noticed that Maple only needs one such beast in order to get by.

> x:=a>b;
                                  x := b < a

> dismantle(x);

LESSTHAN(3)
   NAME(4): b
   NAME(4): a

See the ?dismantle and related help-pages for an introduction to Maple structures. The Advanced Programming Guide may also be useful to you for learning about Maple's internal structures.

acer

interface( rtablesize=50 );

p := randpoly(R,dense,degree=15);

Matrix( [Vector(degree(p)+1,i->i-1),
         PolynomialTools:-CoefficientVector(p,R)] );

Matrix(degree(p)+2,2,
       [[Matrix([n,a[n]])],
        [Matrix([Vector(degree(p)+1,i->i-1),
                 PolynomialTools:-CoefficientVector(p,R)])
        ]]);

Or, with more columns,

restart:
interface( rtablesize=50 ):

p := randpoly(R,dense,degree=15):

V1 := Vector(degree(p)+1,i->i-1):
V2 := PolynomialTools:-CoefficientVector(p,R):
V3 := Vector(degree(p)+1,i->93):
<<n|a[n]|"3rd">,<V1|V2|V3>>;

acer

You could apply evalf to the indexed RootOfs, to get floating-point approximations.

acer

The total derivative of h(x,y,z) is usually taken to refer to an independent variable (let's call it t, though it may in fact not represent time). The premise is that the other variables depend upon this t. And then the total derivative is taken to be,

   del h/del t
 + del h/del x * del x/del t
 + del h/del y * del y/del t
 + del h/del z * del z/del t

Now, either you have in mind that there is some variable t upon which each of x,y,z depend, or you consider that two of x,y,z depend upon the third, eg. x(z) and y(z). If it's the latter situation, h(x(z),y(z)) say, then the total derivative may be taken as,

   del h/del z
 + del h/del x * del x/del z
 + del h/del y * del y/del z

Is either of those the case at hand?

ps. It doesn't look like what is commonly termed a vector-valued function, and the Jacobian may not be what you're after.

acer

It should be possible to change Maple's Standard GUI so that it will compress/decompress worksheets on the fly.

It would be preferable if such a change still allowed one to save worksheets as uncompressed XML.

Such files could have an extension such as .mwz. Hopefully that natural choice of filename extension hasn't been exclusively preempted.

acer

.. with the XMLTools package?

acer

Is this what you wanted?

> simplify(y1c);
                               2         3   25   4   17   5
                  1 + x + 1/2 x  + 5/18 x  + --- x  + --- x
                                             144      144

As for the other part,

> y1g := 1 + x*hypergeom([1, 1 + I, 1 - I], [2, 2], x);
             y1g := 1 + x hypergeom([1, 1 - I, 1 + I], [2, 2], x)
 
> series(y1g,x); # you could increase the order
                           2         3   25   4   17   5      6
              1 + x + 1/2 x  + 5/18 x  + --- x  + --- x  + O(x )
                                         144      144
 
> plot( convert(%,polynom), x=0.5..1.0);

What range are you interested in, for the solution? For x<1, you should be able to plot y1g directly.

acer

Not all of Maple takes advantage of all assumptions.

If there isn't an example on a routine's help-page of it working with assumptions, then that's a hint that the routine doesn't respect assumptions.

In the case of `solve`, the help-pages describe `solve`'s ability to deal with assumptions on parameters but not on the main variables (unknowns for which to solve).

There was a time when almost nothing of interest in Maple took advantage of assumptions. This has been changing, slowly. Making some routines utilize assumptions would be very difficult, and could conceivably require a near-full rewrite for the routine in question.

ps. were you expecting a null return for your example, under the assumptions?

acer

Please tell us what `Ranges` and `Img` are.

I am imagining that an efficient in-place solution using the container=V option may be possible. But it'd help to see the structure of Ranges and Img.

acer

fff := proc(dist, s_one, d, n)
option hfloat;
#
# parameters:
#   sample procedure
#   Starting price stock
#   Trailing distance#
#   Number of periods
#
# returns:
#   Profit/loss with stop loss,
#   Profit/loss without stop loss
#
local rand_, i, A, C, w, w_w_, w_w, C_C,
      Exit_period, Exit_price, Last_close;

    rand_:=dist(n):

    # Stock price
    A[1]:=s_one: # Starting price stock
    for i from 2 to n do
        A[i]:=A[i-1]+rand_[i];
    end do:

    # Trailing Stop-Loss
    C[1]:=(A[1]-d):
    for i from 2 to n do
        if A[i]>A[i-1] and A[i]>(A[i]-d)
          and (A[i]-d)>C[i-1] then
            C[i]:=(A[i]-d);
        else
            C[i]:=C[i-1];
        end if;
    end do:

    w[1]:=0:
    for i from 2 to n do
        if A[i]>C[i] then
            w[i]:=0;
        else
            w[i]:=1;
        end if;
    end do;

    w_w_[1]:=0:
    for i from 2 to n do
        w_w_[i]:=(w[i]+w_w_[i-1]);
    end do;

    w_w[1]:=0:
    for i from 2 to n do
        w_w[i]:=(w_w_[i]+w_w_[i-1]);
    end do;

    # Final Corrections
    C_C[1]:=(A[1]-d):
    for i from 2 to n do
        if w_w[i]=0 then
            C_C[i]:=C[i];
        else
            C_C[i]:=C_C[i-1];
        end if;
    end do:

    ############## Results #########
    # Exit period due to stop loss
    Exit_period:=add(`if`(w_w[i]=1,i,0),i=1..n);

    # Exit price stop-loss
    Exit_price:=`if`(Exit_period=0,0,C_C[n]);

    # Last close stock price
    Last_close:=`if`(A[n]<0,0,A[n]);

    # Profit/loss with stop loss,
    # Profit/loss without stop loss
    `if`(Exit_price=0,Last_close-A[1],Exit_price-A[1]),
    Last_close-A[1];

end proc:


randomize():
X := Statistics:-Sample(Statistics:-RandomVariable(Normal(0,1))):

fff( X, 100, 4, 100 );

seq( fff( X, 100, 4, 100 ), i=1..10 );

time( seq( fff( X, 100, 4, 100 ), i=1..1000 ) );

If you need this to be really fast, then the local tables (A, C_C, etc) could be created as float[8] Vectors outside of fff and then get passed in and re-used.

acer

How about putting the whole thing in a procedure called f (which might even take no arguments at all. Have it return that final result. Then call f() repeatedly, or call seq(f(),i=1..10).

acer

I thought that _S01 (and other names similarly prefixed by _S) are what `solve`  uses to manage substitutions internally. That is to say, that they are temporary placeholders that `solve` uses while it does its work. If that's true, then it could well be a bug if they appear in the return value.

Could you post or upload an example of input, and say what Maple version you're using?

acer

Have you read the Maple help-page for limit and limit,return ?

acer

I've tried to lay out a method, and prototype code, for doing this here.

acer

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