Carl Love

Carl Love

28050 Reputation

25 Badges

12 years, 335 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

Like the other respondents, I immediately saw that what you were trying to do (other than the part about preserving the names) is essentially covered by foldl (or `@@` in the univariate case). And I largely share Acer's misgivings about preserving the names. However, the fact that it's possible to do what you want with a short procedure is one of the things that I find so compelling about Maple, so here's a recursive implementation of Iter:

Params:= (f::procedure)-> op~(1, op~(1, [op(1, eval(f))]))
:
Iter:= proc(f::procedure, n::nonnegint, p::posint:= 1)
local P:= Params(f);
    if n=0 then subs(_P= P[], _F= P[p], _P-> _F)
    elif n=1 then eval(f)
    else 
        subs(
            _P= P[], 
            _F= f(P[..p-1][], thisproc(f, n-1, p)(P[]), P[p+1..][]), 
            _P-> _F
        )
    fi
end proc
:
#Examples:
for k from 0 to 3 do Iter((x,y)-> f(x,y), k) od;
        (x, y)-> x
        (x, y)-> f(x, y) 
        (x, y)-> f(f(x, y), y)
        (x, y)-> f(f(f(x, y), y), y) 
#Iterate on the 2nd position by using the optional 3rd argument:
Iter((x,y)-> f(x,y), 2, 2);
        (x, y)-> f(x, f(x, y))

Note that I've avoided any use of unapply by careful use of subs.

Warning: This ignores the possibility that the parameter names have been assigned values as globals.

Edit: That assigned-global problem is solved in a Reply below.

@shkarah For each value of H, do

ExcelTools:-Export(op([1,1], P[H]));

@digerdiga You asked:

  • The Float() are just the rational numbers n/101 where n=0...100 or?

Yes, rational numbers in decimal (or "float") form.

  • I guess that's what happens also with other generators?

As far as I'm aware, most PRNGs (and certainly all those commonly used in Maple) work by first generating integers uniformly in some interval and then transforming them to the form requested by the user.

  • Why do you call the procedures
        ModuleApply:=...
        ModuleLoad:=...
    ? Do these names serve any purpose?

Yes, the procedure names ModuleApply and ModuleLoad (as well as several others that begin Module...) have special meaning to Maple, and you can read about them on their help pages. Briefly, ModuleApply is the procedure that is called if the module's own name (Rand in this case) is invoked as if it were a procedure, e.g., Rand(), and ModuleLoad is a procedure that is called when the module is read from a library (which doesn't actually happen in this case because the module's code appears directly in the worksheet).

@Glowing So, as far as you're aware, Maple 2019.2.1 is the only multiprocessing application with which you cannot achieve 100% CPU utilization?

@kfli I think that you misunderstood my Comment. I'm not suggesting that you shouldn't use multiprocessing. I'm suggesting that you not use multiprocessing just for the final step---the conversion of a 3D Array to a Vector. That step is a triviality if done with Alias.

@Glowing But did you get 100% CPU utilization during the CPU test? 

@Glowing Is it possible to reverse the effects of that voltage-lowering utility? If so, reverse it, at least temporarily, to see if it makes a difference. And check that BIOS also.

When, I run my computers at 100%, I can feel them get hot in 5-10 seconds. I don't see how this utility could stop your computer from getting hot without limiting its performance.

I suspect that the difference you saw between the trial and full versions of Maple 2019 is just a coincidence. Maybe it was just that your ambient air temperature was lower, or your computer was on a surface that allowed more airflow.

@mehdi jafari I was just suggesting that you look carefully at the results of the inner integral to get ideas on how to proceed. In the above you suppressed the output of the inner integral, so you may not have learned anything from it.

@kfli If I understand this correctly, at the end of a certain phase of multiprocessing you have some 3-dimensional Arrays. Then you want to turn each of these Arrays into a Vector by laying rows (or columns, or the 3rd dimension) end-to-end. Is that right? If that's all you want, it's trivial to accomplish with ArrayTools:-Alias, and there's no point in using multiprocessing for that phase. The re-indexing is done in the background, and there's no copying of data.

@digerdiga asked:

  • So, but I do need to call randomize() before rand(0.0..1.0) in order for rand to give different random numbers?

If you want different random numbers, you should call randomize() once per session (a restart starts a new session). Don't call randomize for each random number; indeed, doing so virtually guarantees that the numbers won't be random because the clock doesn't change fast enough.

  • Are the numbers by randomize pseudo-random or true random numbers?

A call to randomize() with no arguments sets the seed to a value based on the real-time clock (something like the number of milliseconds since 1970). Once a seed is set, the sequence of random numbers is fixed. They are pseudo-random. Only very special computers can generate true random numbers. They need to measure something in the physical world, such as cosmic rays or the position of the opaque liquid in a Lava Lamp.

Note that randomize() does not generate random numbers. Rather, it sets the seed so that rand (and other commands) will use a new sequence of random numbers.

@shkarah Those things are only meaningful if a specific value of eta is used. And what's the point of making into a list of 4 values when you want it to vary continuously?

Make into an exact rational, like 3/10. Then look at the results of just the symbolic inner integral:

int(f*exp(-x), x= 0..y + t, AllSolutions);

@Preben Alsholm I was wrong about the computations between exact rationals being done first, but I did not mean that when parentheses were used.

@shkarah 

1. You can't use fi as a variable name in Maple; it's a reserved word (i.e., one that has special syntactic meaning, kind of like a punctuation mark). So, change this name to something else, such as Fi.

4. Plot f vs R: Do you mean that you want a plot of 4 curves f vs eta for the 4 values of given (like I did the 4 curves for different values of H)? If so, I need fixed values of and alpha, so what should I use?

5. Same question.

Unfortunately, there's a bug in MaplePrimes regarding uploading .maple files. Can you make that a .zip file and upload again? Or if there's no data files, just upload the .mw.

First 229 230 231 232 233 234 235 Last Page 231 of 709