Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@J4James Looking at any standard Numerical Analysis textbook, you will find numerous proofs of the accuracy of numerical schemes. These proofs put upper bounds on the errors. But you originally asked about residuals, not upper bounds. The residuals cannot be known unless the exact solution is known.

PatrickT wrote:

rhs(g[1]);
The above works also directly with a sequence (without the []).

Except that it doesn't work when the sequence has only one element. Moral: When is doubt, use lists instead of sequences.

PatrickT wrote:

rhs(g[1]);
The above works also directly with a sequence (without the []).

Except that it doesn't work when the sequence has only one element. Moral: When is doubt, use lists instead of sequences.

While the discussion of the mathematical properties of the integrals is interesting, the main question remains: Why is _method= _Sinc using a linearly increasing amount of time (so that the overall loop time is quadratic in the loop size) for randomly chosen integrals? Yes, I definitely think that there's a bug! Even running your test twice in sucession without a restart shows the times starting where the previous loop had finished.

@samiyare I think that fsolve is slow because it is trying to get a solution that is guaranteed accurate to the full value of Digits, which is ridiculous in this situation because dsolve's solution is not as precise(The BVP solvers have a default absolute error tolerance of 1e-6 regardless of Digits. See ?dsolve,numeric,BVP .) And fsolve does not have any way for the user to set a more lenient error tolerance. This is very often a problem with fsolve. AFAIK, fsolve is Maple's only major numeric command that does not allow the user to set error tolerances. Note that Preben's solution used a tolerance option to Student:-NumericalAnalysis:-Secant.

@samiyare I think that fsolve is slow because it is trying to get a solution that is guaranteed accurate to the full value of Digits, which is ridiculous in this situation because dsolve's solution is not as precise(The BVP solvers have a default absolute error tolerance of 1e-6 regardless of Digits. See ?dsolve,numeric,BVP .) And fsolve does not have any way for the user to set a more lenient error tolerance. This is very often a problem with fsolve. AFAIK, fsolve is Maple's only major numeric command that does not allow the user to set error tolerances. Note that Preben's solution used a tolerance option to Student:-NumericalAnalysis:-Secant.

@N00bstyle Look at ?set for your more-detailed info. Basically, whenever you put something in curly braces ({}), Maple, not you, gets to control the order.

@N00bstyle Look at ?set for your more-detailed info. Basically, whenever you put something in curly braces ({}), Maple, not you, gets to control the order.

@J4James 

To help you, I need to know what your goal is. Do you want a certain plot? 2D or 3D? Animated? What would be the independent variables of the plot? If animated, what is the independent variable in the animation dimension?

@J4James 

To help you, I need to know what your goal is. Do you want a certain plot? 2D or 3D? Animated? What would be the independent variables of the plot? If animated, what is the independent variable in the animation dimension?

@J4James Your triple loop ends thus:

end do:
end do:
do;

The last one needs to be end do also.

The loop still seems wasteful, in the manner Preben mentioned. The final result of the loop depends only on outer loop variable. In other words, you overwrite the value A[i] 30 times for each i.

@J4James Your triple loop ends thus:

end do:
end do:
do;

The last one needs to be end do also.

The loop still seems wasteful, in the manner Preben mentioned. The final result of the loop depends only on outer loop variable. In other words, you overwrite the value A[i] 30 times for each i.

@baldysm The tutor allows you to enter invalid rewrites. Did you enter cos(x) in the From box and -sin(x) in the To box? That's not valid.

[This procedure has been completely updated from the version that I posted this morning.]

Here's my procedure for converting from disjcyc to a table-form permutation. I'm not sure what is the earliest version of Maple in which this will run. If you get a syntax error, let me know, and I can easily downgrade this version.

This is equivalent to your version, except that I the concatenate the seqs only once--as they are created--and there's only one call to table. Also, note that the kth element of a list L can be addressed simply as L[k], which is cleaner looking than op(k, L).

`convert/permtable`:= proc(
     DJCF::list(list(posint)),
     degree::posint:= max(map(op,DJCF))
)
local k, cyc;
     table([
          seq(k=k, k= 1..degree),
          seq(
               [seq(cyc[k]=cyc[k+1], k= 1..nops(cyc)-1),
                cyc[-1]=cyc[1]
               ][],
               cyc= DJCF
          )
     ])
end proc:

Usage:
convert([[2,1],[4,3]], permtable, 5);

combinat:-randperm(23);
[9, 10, 12, 21, 3, 18, 11, 19, 15, 23, 1, 14, 20, 16, 22, 2, 4, 8, 7, 17, 13, 5, 6]

convert(%, disjcyc);
[ [1, 9, 15, 22, 5, 3, 12, 14, 16, 2, 10, 23, 6, 18, 8, 19, 7, 11], [4, 21, 13, 20, 17]]

convert(%, permtable);



[This procedure has been completely updated from the version that I posted this morning.]

Here's my procedure for converting from disjcyc to a table-form permutation. I'm not sure what is the earliest version of Maple in which this will run. If you get a syntax error, let me know, and I can easily downgrade this version.

This is equivalent to your version, except that I the concatenate the seqs only once--as they are created--and there's only one call to table. Also, note that the kth element of a list L can be addressed simply as L[k], which is cleaner looking than op(k, L).

`convert/permtable`:= proc(
     DJCF::list(list(posint)),
     degree::posint:= max(map(op,DJCF))
)
local k, cyc;
     table([
          seq(k=k, k= 1..degree),
          seq(
               [seq(cyc[k]=cyc[k+1], k= 1..nops(cyc)-1),
                cyc[-1]=cyc[1]
               ][],
               cyc= DJCF
          )
     ])
end proc:

Usage:
convert([[2,1],[4,3]], permtable, 5);

combinat:-randperm(23);
[9, 10, 12, 21, 3, 18, 11, 19, 15, 23, 1, 14, 20, 16, 22, 2, 4, 8, 7, 17, 13, 5, 6]

convert(%, disjcyc);
[ [1, 9, 15, 22, 5, 3, 12, 14, 16, 2, 10, 23, 6, 18, 8, 19, 7, 11], [4, 21, 13, 20, 17]]

convert(%, permtable);



First 639 640 641 642 643 644 645 Last Page 641 of 708