Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 27 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@erik10 The () makes the procedure immediately above it execute; it's like the () in f(). Without the () it would just be a procedure definition.

@erik10 I forgot to test my code after a restart. I just had to add two lines at the top, which you'll see. Here's the corrected version.

Simu_para_evalhf.mw

@erik10 I forgot to test my code after a restart. I just had to add two lines at the top, which you'll see. Here's the corrected version.

Simu_para_evalhf.mw

@erik10 Erik wrote:

In a previous comment you suggested to remove my variable broekdel, but I have introduced it again, because it increases the execution time, when the program need to calculate the left hand side in A[number] - j  > L[n] again and again.

Yes, I realized after I posted that removing that variable wouldn't be a good idea if you decided to make c (the number of columns) larger.

Erik wrote:

One last thing I would like is to use the parallelism suggested by Carl, but I am not sure how to combine your earlier code with Acers.

But the last version that I posted does have a parallelization of Acer's code! That was whole point of my latest version.

@erik10 Erik wrote:

In a previous comment you suggested to remove my variable broekdel, but I have introduced it again, because it increases the execution time, when the program need to calculate the left hand side in A[number] - j  > L[n] again and again.

Yes, I realized after I posted that removing that variable wouldn't be a good idea if you decided to make c (the number of columns) larger.

Erik wrote:

One last thing I would like is to use the parallelism suggested by Carl, but I am not sure how to combine your earlier code with Acers.

But the last version that I posted does have a parallelization of Acer's code! That was whole point of my latest version.

Here, I generate the same sequence in Maple. This works nearly instantaneously. But it is still quite impressive that Mathematica figures all this out just from the command that you gave.


restart:

Let  A(n) be the "power tower" sequence, defined recursively by A(1) = 1, A(n) = n^A(n-1). The following procedure computes A(n) mod 10^10, i.e., the last ten decimal digits of A(n).

ph:= numtheory:-phi(10^10):

PowerTower:= proc(n)
option remember;
     n &^ (`if`(n<5, 0, ph)+thisproc(n-1)) mod 10^10
end proc:

PowerTower(1):= 1:

for n to 50 do printf("%2d...%10d\n", n, PowerTower(n)) end do;

 1...         1

 2...         2
 3...         9
 4...    262144
 5...8212890625
 6...1787109376
 7...9058585601
 8...6797099008
 9...8779806721
10...         0
11...         1
12...1445312512
13... 116372481
14...2435774464
15...8212890625
16...1787109376
17... 266721281
18...2305824768
19...5482787841
20...         0
21...         1
22...9316406272
23...7653969921
24...6742273024
25...8212890625
26...1787109376
27...1474856961
28...6950320128
29... 620559361
30...         0
31...         1
32...7187500032
33...6581314561
34...  27920384
35...8212890625
36...1787109376
37...2682992641
38...9565913088
39...4864097281
40...         0
41...         1
42...5058593792
43...7786342401
44... 543340544
45...8212890625
46...1787109376
47...3891128321
48...2131611648
49...8387737601
50...         0

 


Download PowerTower.mw

The above plot, which is surprisingly smooth for an error plot, was made at my default setting of Digits, 15. At the more usual setting Digits = 10, you get the following more-erratic and more-normal error plot. Note that the magnitude of the scale is the same. It is also interesting to see how adjusting the dsolve options abserr, initmesh, and maxmesh affects the plot (see ?dsolve,numeric,BVP ). Note that the default setting of abserr is 1e-6, and the errors that we're actually getting are several orders of magnitude below that. So, that's fairly impressive.

The above plot, which is surprisingly smooth for an error plot, was made at my default setting of Digits, 15. At the more usual setting Digits = 10, you get the following more-erratic and more-normal error plot. Note that the magnitude of the scale is the same. It is also interesting to see how adjusting the dsolve options abserr, initmesh, and maxmesh affects the plot (see ?dsolve,numeric,BVP ). Note that the default setting of abserr is 1e-6, and the errors that we're actually getting are several orders of magnitude below that. So, that's fairly impressive.

There's still the issue of getting the fsolve (or another solver) to work with the procedure. I'm working on it now. This problem is very similar to this Asker's question from a few days ago about an integro-differential equation. I never got that to converge (I think because of a 0/0 issue), but I am going to try the same technique. Basically, we need to see the messages that dsolve returns so that we can fine tune the dsolve options. Also, I am going to make the derivative of the integral one of the equations in the system to avoid the need for numerical integration.

Amir: From your new coding, it looks like you learned a lot from the Answers to your question from a few days ago. Have you managed to solve any of these integro-differential equations? I think a different name is needed because the integral does not depend on the independent variable; it only depends on the solution functions. How about "BVP with constraining integral"?

This is an exciting problem. Maybe there's a paper in this.

There's still the issue of getting the fsolve (or another solver) to work with the procedure. I'm working on it now. This problem is very similar to this Asker's question from a few days ago about an integro-differential equation. I never got that to converge (I think because of a 0/0 issue), but I am going to try the same technique. Basically, we need to see the messages that dsolve returns so that we can fine tune the dsolve options. Also, I am going to make the derivative of the integral one of the equations in the system to avoid the need for numerical integration.

Amir: From your new coding, it looks like you learned a lot from the Answers to your question from a few days ago. Have you managed to solve any of these integro-differential equations? I think a different name is needed because the integral does not depend on the independent variable; it only depends on the solution functions. How about "BVP with constraining integral"?

This is an exciting problem. Maybe there's a paper in this.

@Christopher2222 In Maple17 (or online) check out ?SignalProcessing .

@Christopher2222 In Maple17 (or online) check out ?SignalProcessing .

Erik wrote:

I am not entirely sure how you make the computer use all processors? I am not an expert on programming, so please be detailed ;)

For a start, how about downloading the code that I uploaded and taking a look at it and/or using it? Also, let's see how many processors Maple thinks that you have. Execute the following line in any Maple session.

kernelopts(numcpus);

And, do know how many processors your computer actually has?

The most basic technique for parallelizing is to take the outermost loop and and re-express it using seq or map instead of for. You can't change variables that are global to (or at higher scope than) the loop because of conflicts that would occur when separate processes try to change them at the same time. So, you make them local. Then change the seq or map to Threads:-Seq or Threads:-Map. That's all there is to it for the most basic technique. Parallelizing will only work if the loop iterations are independent. In other words, the results of later iterations cannot depend on the results of earlier iterations.

Erik wrote:

I am not entirely sure how you make the computer use all processors? I am not an expert on programming, so please be detailed ;)

For a start, how about downloading the code that I uploaded and taking a look at it and/or using it? Also, let's see how many processors Maple thinks that you have. Execute the following line in any Maple session.

kernelopts(numcpus);

And, do know how many processors your computer actually has?

The most basic technique for parallelizing is to take the outermost loop and and re-express it using seq or map instead of for. You can't change variables that are global to (or at higher scope than) the loop because of conflicts that would occur when separate processes try to change them at the same time. So, you make them local. Then change the seq or map to Threads:-Seq or Threads:-Map. That's all there is to it for the most basic technique. Parallelizing will only work if the loop iterations are independent. In other words, the results of later iterations cannot depend on the results of earlier iterations.

@tuGUTS 

Most of what you say makes some sense, but I have a lot of trouble understanding your English. However, what you start off with is utter nonsense: A matrix is not a group. A matrix can be a member of a group, but it is not by itself a group. A group is a set together with a binary operation on that set that satisfies certain properties.

First 643 644 645 646 647 648 649 Last Page 645 of 709