Stretto

260 Reputation

5 Badges

6 years, 87 days

MaplePrimes Activity


These are questions asked by Stretto

I have a proc that takes a function. This function is called  when the proc needs it to. Normally it will simply do a computation. The return is generally ignored(since the proc is a bit non-deterministic). I would like, though, to store values computed within the function in a global variable. I can't seem to use assign since it forces the variable to be local.

I can print the result of the function and it shows up but what is the proper way to assign variables within a function:

e.g.,

plot(store(x),x=1..2);

Then store would somehow store the values passed to the function(and in this case probably returning x). The example is not my use case and may not actually work properly.I cannot use global in the function passed as an argument to create a global variable.

F := proc(f)

    blah blah f(3)
    blah blah f(4)

end proc;

R := []:

F(x->store(R, x));

R = [3,4]

Is there a way to print points that have additional information that can be probed when mousing over the points?

I have an array of arrays with information in each element including the point: [x,y1,y2,R1, R2, R3, R4]

Where y1 and y2 are different values to graph per x(different plots)  and Rk are records for the data(other info that goes along with them such as day of week, rainfall on that day, etc). The different graphs might have different scales so it would be nice if they handled scaling effectively(e.g., |y1| < 1 and y2 > 3430).

I have about 50k points so it has to be relatively fast... as it's already taking a few minutes to process the data in to the array from a file using fopen and readline(not sure why so slow as I'm just using a few parses and cats to put it in an array but probably is being slowed by not being able to pre-allocate the array.

q := (f)->local ff := `if`(type(f,procedure),f,`x`->f); ff(z + (ff(k))):

Trying to create something so that I can do q(x) or q(x->x^2) or whatever.

Trying to understand the difference between an expression and a function as represented by maple. I thought I could just turn whatever is passed to q, such as x*cos(x) in to a function by x->x*cos(x) as one would do normally but this does not work.

Is there any easy way to do subs([a,b,c]=x, [2,4,5,1,a,4,5,a,b,434,a,b,c,5,5,5,1]) = [2,4,5,1,a,4,5,a,b,434,x,5,5,5,1]

and another way to get [2,4,5,1,a,4,5,a,b,434,x,b,c,5,5,5,1]

The first subsitutes the entire match and the second substitutes when matches but only for first element.

I know I can write routines to do this and will after posting this but is there a native way that is simple?

Is there a way to take a long integer representing the ticks in JS and convert them to a date in maple?

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