Stretto

250 Reputation

5 Badges

5 years, 221 days

MaplePrimes Activity


These are questions asked by Stretto

RandC := proc(k := getSystemTimeMS())
    local r,b,g,kk;
    kk := k+ parse(convert(Time(), string)[6..18]);
    kk := (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    r := rand(0..1.0)();
    kk := k+ parse(convert(Time(), string)[6..18]);
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    kk := (randomize(round(kk*r + k + time[real]() + getSystemTimeMS())));    
    g := rand(0..1.0)();
    kk := k+ parse(convert(Time(), string)[6..18]);
    (randomize(round(k*time[real]() + getSystemTimeMS() + time[real]())));    
    kk := (randomize(round(kk*g + k*r*time[real]() + getSystemTimeMS())));
    b := rand(0..1.0)();
    [RGB(r,g,b)];
end proc:

Been trying to generate random colors but nothing works because obviously maple decides to cache the results if the arguments are the same. If I call RandC with an argument that changes it will give me different values. If not it will sometimes give me different values but usually there will be long strings of the same value.

Hence when I generate a sequence of random colors I will almost always get a sequence of the same color or a sequence that containst the same color many times. I'd like to be able to use RandC without having to provide arguments.

(all the junk in the function was trying to get it to randomize properly as I didnt' realize maple was caching. Also Value(Time()) does not return the ms and seems to do nothing which contradicts the help and hence the parse)

This seems like a dangerous thing for maple to do. Silently caching results that depend on random generation will result in non-random results. It could skew many results.

An animation only allows one time parameter.

I have an setup in which I have a time parameter + another parameter or more(e.g., offset, scale, whatever).

I would like some way to easily traverse phase space and see the result and animate with time at those specific parameters(ideally animate along any path in the phase space).

In my case what this means is that there is a 2D rectangle in which represents the phase space. E.g., time x offset. This effects the animation by setting the current parameters. If the animation is animated in time it moves across the vertical. Basically a "2d slider". Alternatively have actually 2(or more) independent sliders.

Currently I have to manually set the parameter then re-execute the animation to see the new animation.

e.g.,

  animation(plot, [f(t,offset)], t=0..1,offset=1..5)

Suppose I have a matrix representing a magma such as

matrix(n,n, (i,j)->E[i].E[j])

First, if E is a set of integers then . is converged to * for some reason.

Second, is there any way to simplify the presentation of this matrix? I am using subs to simply but I have to essentially hand code every entry which sort of defeats the purpose. Is there any way to present a matrix and then have the resultant simplified as far as possible?

E.g., subs does not allow one to do something like ?.E[3] = E[2] where ? represents any value. E.g., if I have an identity it would be nice to simplify all elements quickly with one expression rather than having one for all possibilities(essentially 2n).

Also, magma's only let positive integers which seems kinda restrictive(why not create map internally to handle it?).

Also, is there any way to use special chars like -? I'm using d but I'd prefer using special chars so it is visually more congruent to what I'm doing. I realize - is also a minus but maybe there is someway around it(unicode?)?

I have a relatively simple procedure that attempts to provide a continuous function from arctan.

This function, when called is not returning values properly for some unknown reason. It is not updating variables.

The code is relatively simple, given a continuous vector valued function it gets the angle using arctan(y,x). The problem with this function is that it is not continuous as it only evaluates the function along the principle branch.

What the function below attempts to do is find out when the function has a jump discontinuility and it provides the amount to shift to make the output continuous. To do this requires some memory which is stored in the global variable l.

vs := t->[cos(3*t), sin(t)];
nvs := t->sqrt(vs(t)[1]^2 + vs(t)[2]^2);
v := t->vs(t); l/~nvs;

l := 0:
ls := [0,0]:
ArgK := proc(f, t)
    local e := 0.005, q := 0, y1, y2:
    global l, ls:    
    y1 := evalf(arctan(f(t)[2], f(t)[1]),50);
    y2 := evalf(arctan(f(t+e)[2], f(t+e)[1]),50);
    if ls[1] = 0 then
        if abs(y2 - y1) > 1.5 then l := l - sgn(y2 - y1)*2*Pi; ls := [1,t]: q := 1434: fi;

    fi;
    #arctan(f(t)[2], f(t)[1]) + l;
    [l,q, IF(abs(y2 - y1) > 1.5)];
end proc:

l := 0:
ArgK(v,Pi/2);
ArgK(v,Pi);
([seq([2*Pi*k/10, ArgK(v,2*Pi*k/10)],k=0..10)]);
listplot([seq([2*Pi*k/1000, ArgK(v,2*Pi*k/1000)[1]],k=0..1000)]);

output:

                           [0, 0, 0]

                        [2 Pi, 1434, 1]

[                   [1                 ]  [2                 ]  
[[0, [2 Pi, 0, 0]], [- Pi, [2 Pi, 0, 0]], [- Pi, [2 Pi, 0, 0]],
[                   [5                 ]  [5                 ]  

  [3                 ]  [4                 ]                      
  [- Pi, [2 Pi, 0, 0]], [- Pi, [2 Pi, 0, 0]], [Pi, [2 Pi, 0, 1]],
  [5                 ]  [5                 ]                      

  [6                 ]  [7                 ]  
  [- Pi, [2 Pi, 0, 0]], [- Pi, [2 Pi, 0, 0]],
  [5                 ]  [5                 ]  

  [8                 ]  [9                 ]                      
  [- Pi, [2 Pi, 0, 0]], [- Pi, [2 Pi, 0, 0]], [2 Pi, [2 Pi, 0, 0]]
  [5                 ]  [5                 ]                      

  ]
  ]
  ]

The nonsense output is not my fault, copying directly from maple. The main thing is thatat 2pi, the output should be 1434(see 2nd line) but there is no 1434. The output is completely ignored. It seems the correct jump is never calculated properly in the sequence although it works fine manually and has worked before when messing with the code.

e.g., these should be identical

[2 Pi, 1434, 1]

[Pi, [2 Pi, 0, 1]],

yet there is a 0 where there should be a 1434. (I was using q to figure out why the thing was not working)

I've been playign around with the code trying to get it to work but I've not been able to as maple is doing something very funky.  It should be a very simple problem of detecting a jump discontinuility then adding an appropriate amount(which must be tracked).

ls was used because I was getting wierd results around the discontinuity where the test would be called multiple times, I guess because something to do with the evaluation in plotting.

E.g., commenting out the ls if statement will get the step function one epects except it's not the right values.

The idea is simple though. For a continuous function theta(t) one should be able to provide a full and meaningful angle that takes in to account the correct branch when extracting this angle from a continuous function that is known to provide a continuous theta(t). i.e., Ang(f(t)) should be continuous. This is what I'm trying to achieve.

convert(series(f(x),x,10),list) will produce a list with exponents rather than 0's. Is there a natural way to simply get a list with 0 padding? Also, can one make their own type converter?  (obviously I can make a procedure but talking about something in accordance with convert)

1 2 3 4 5 6 7 Last Page 1 of 16