Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@N00bstyle 

In method (2), you have the [] inside the parentheses; it needs to go outside, as in this skeleton:

A,B,C:= subs(...= ..., [..., ..., ...] ) []

This says "Make the substitutions in the list [..., ..., ...], THEN turn the list into a sequence (of three items) to match with A,B,C." With the [] inside the parentheses, it says "Turn the list into a sequence, THEN pass that to subs," which subs interprets as nonsense because you are trying to pass it four arguments.

 

In method (3), you used the wrong type of quote marks. It's `if`, not 'if'. On a standard US keyboard, the single back quote is in the upper left corner, under ESC, on the same key as ~.

@N00bstyle 

In method (2), you have the [] inside the parentheses; it needs to go outside, as in this skeleton:

A,B,C:= subs(...= ..., [..., ..., ...] ) []

This says "Make the substitutions in the list [..., ..., ...], THEN turn the list into a sequence (of three items) to match with A,B,C." With the [] inside the parentheses, it says "Turn the list into a sequence, THEN pass that to subs," which subs interprets as nonsense because you are trying to pass it four arguments.

 

In method (3), you used the wrong type of quote marks. It's `if`, not 'if'. On a standard US keyboard, the single back quote is in the upper left corner, under ESC, on the same key as ~.

@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 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 .

First 642 643 644 645 646 647 648 Last Page 644 of 708