John Fredsted

2253 Reputation

15 Badges

20 years, 193 days

MaplePrimes Activity


These are replies submitted by John Fredsted

I am happy to hear that it seems wrong to you too. The `index/antisymmetric` is built-in, see the help page ?antisymmetric, from which it is also clear that the diagonal elements of an antisymmetric Matrix is 0. I have written the following indexing function to circumvent that:
`index/AntiSym` := proc(inds::[posint,posint],comps::Matrix,entry::list)
	local row,col,sign;
	row,col,sign := inds[],+1;
	if row > col then row,col,sign := col,row,-1 end if;
	if nargs = 2 then
		return sign*comps[row,col]
	else
		if row = col then
			comps[row,col] := Matrix(4,4)
		else
			comps[row,col] := sign*op(entry)
		end if
	end if
end proc:
But it is not quite satisfactory, the problem being the explicit use of dimension 4 in Matrix(4,4). Of course, using assign, this indexing function could be embedded into another function which could be called with a parameter to specify that number, but it seems to me that there will be as many different (global, necessarily) custom indexing functions as there are different Matrix dimensionalities needed. Is there any way around that? PS: Congratulations on your 500 points, which funnily enough you share with Robert Israel who also has exactly 500 points at this time of writing.
Maybe the function add is what you are looking for:
k,n := 4,6:
x := [seq(x||j,j=1..k)];
y := [seq(y||i,i=1..n)];
expr := (add(x[j] - b,j=1..nops(x)) - add(y[i] - b,i=1..nops(y)))^2;
                     x := [x1, x2, x3, x4]
                 y := [y1, y2, y3, y4, y5, y6]
                                                               2
expr := (x1 + 2 b + x2 + x3 + x4 - y1 - y2 - y3 - y4 - y5 - y6) 
If you need it, you can expand expr using the function expand:
expand(expr);
x1^2+4*x1*b+2*x1*x2+2*x1*x3+2*x1*x4-2*x1*y1-2*x1*y2-2*x1*y3-2*x1*y4-2*x1*y5-2*x1*y6+4*b^2+4*b*x2+4*b*x3+4*b*x4-4*b*y1-4*b*y2-4*b*y3-4*b*y4-4*b*y5-4*b*y6+x2^2+2*x2*x3+2*x2*x4-2*x2*y1-2*x2*y2-2*x2*y3-2*x2*y4-2*x2*y5-2*x2*y6+x3^2+2*x3*x4-2*x3*y1-2*x3*y2-2*x3*y3-2*x3*y4-2*x3*y5-2*x3*y6+x4^2-2*x4*y1-2*x4*y2-2*x4*y3-2*x4*y4-2*x4*y5-2*x4*y6+y1^2+2*y1*y2+2*y1*y3+2*y1*y4+2*y1*y5+2*y1*y6+y2^2+2*y2*y3+2*y2*y4+2*y2*y5+2*y2*y6+y3^2+2*y3*y4+2*y3*y5+2*y3*y6+y4^2+2*y4*y5+2*y4*y6+y5^2+2*y5*y6+y6^2
Maybe the function add is what you are looking for:
k,n := 4,6:
x := [seq(x||j,j=1..k)];
y := [seq(y||i,i=1..n)];
expr := (add(x[j] - b,j=1..nops(x)) - add(y[i] - b,i=1..nops(y)))^2;
                     x := [x1, x2, x3, x4]
                 y := [y1, y2, y3, y4, y5, y6]
                                                               2
expr := (x1 + 2 b + x2 + x3 + x4 - y1 - y2 - y3 - y4 - y5 - y6) 
If you need it, you can expand expr using the function expand:
expand(expr);
x1^2+4*x1*b+2*x1*x2+2*x1*x3+2*x1*x4-2*x1*y1-2*x1*y2-2*x1*y3-2*x1*y4-2*x1*y5-2*x1*y6+4*b^2+4*b*x2+4*b*x3+4*b*x4-4*b*y1-4*b*y2-4*b*y3-4*b*y4-4*b*y5-4*b*y6+x2^2+2*x2*x3+2*x2*x4-2*x2*y1-2*x2*y2-2*x2*y3-2*x2*y4-2*x2*y5-2*x2*y6+x3^2+2*x3*x4-2*x3*y1-2*x3*y2-2*x3*y3-2*x3*y4-2*x3*y5-2*x3*y6+x4^2-2*x4*y1-2*x4*y2-2*x4*y3-2*x4*y4-2*x4*y5-2*x4*y6+y1^2+2*y1*y2+2*y1*y3+2*y1*y4+2*y1*y5+2*y1*y6+y2^2+2*y2*y3+2*y2*y4+2*y2*y5+2*y2*y6+y3^2+2*y3*y4+2*y3*y5+2*y3*y6+y4^2+2*y4*y5+2*y4*y6+y5^2+2*y5*y6+y6^2
Thanks for correcting my misunderstandings. I must admit that after posting I had my doubts whether my post was fully sound, differential equations definitely not being a very familiar subject to me. Now I know that my doubts were well-founded.
You can proceed as follows: From
PDE := diff(c(x,t),t)=diff(c(x,t),x,x):
PDE_SOL := pdsolve(PDE);
it is seen that c(x,t) can be written as a product of the two solutions _F1(x) and _F2(t) of two separate ODEs. These ODEs you can pick out by writing:
ODE1 := op(PDE_SOL)[2][1][1];
ODE2 := op(PDE_SOL)[2][1][2];
Subsequently, you can solve these two ODEs independently:
ODE1_SOL := dsolve(ODE1);
ODE2_SOL := dsolve(ODE2);
Finally, you can construct the general solution as follows (the substitution of _C3 for _C1 in ODE2_SOL is a technical necessity because _C1 appears in both ODE1_SOL and ODE2_SOL):
SOL := rhs(ODE1_SOL) * rhs(subs(_C1 = _C3,ODE2_SOL));
and check that it actually is a solution of the original PDE:
evalb(simplify(subs(c(x,t) = SOL, PDE)));
Of course, one issue remains; you have to figure out how your boundary conditions constrain the constants of integration, _c1, _C1, _C2, and _C3.
Maybe I am misunderstanding the question, but why not use an external editor to create the Maple document, and then subsequently use read to execute it in Maple? In this way only one single Maple line, the read statement itself, will be contained in the exported HTML document.
You are quite welcome.
You are quite welcome.
I did not know that one could use negative indices for matrices.
I did not know that one could use negative indices for matrices.
To link to an image, first of all you have to upload it, using my files under Navigation. Having done that the image itself (as the image I have used above, where I have manually stripped away any HTML a tags), or the image as a clickable link, may be created from copy-pasting the text in the textarea Download Link Code under my files.
For the large matrices you consider the results for one single Kronecker product are as follows:
Robert Israel		kronprod			8.8
Sandor Szabo		Tensorproduct		97
John Fredsted		KroneckerProduct		1.2
Acer			KroneckerProduct2		1.4
Douglas Keenan		KroneckerProd		0.40
Douglas Keenan		KroneckerProd2		0.45
Douglas Keenan		KroneckerProd3		1.9
Note that for large matrices KroneckerProduct, which was around ten times slower than KroneckerProduct2 for small matrices, are now a bit faster. The winner, though, for large matrices seems to be KroneckerProd, your original suggestion.
As correctly stated by Scott, you can link to other parts of MaplePrimes, or for that matter to external webpages, using the HTML tag a with its associated attribute href. This tag and its attribute you may enter by pressing the link-image (please disregard the black background), which you can find above the area where you enter your text, the result being <a href="http://"> The part between the two "'s is where your link address, the socalled URL (Uniform Resource Locator) must be inserted.
  • So to link to your other thread, as Scott has done for you, you have to write (or better, copy-paste the long URL to avoid typos) the following: <a href="http://www.mapleprimes.com/forum/equality-of-sets-and-sets-of-sets-of-lists-of-floating-point-real-numbers">My other thread</a> which on the screen will look like My other thread.
  • To link to a specific post in a thread, to the URL of the thread itself you have to append #comment-..... where for ..... you have to write the post's unique number. This unique number you can find by placing your mouse over the link email this comment of the post to which you want to link, and (in the Microsoft Internet Explorer) at the lower left of your screen identify the last five digits. So to link to your post above, say, write <a href="http://www.mapleprimes.com/forum/why-does-evalb-evalf-10-0-evalf-10-0-float-1-0-30-false#comment-11487">My post above</a> which on the screen will look like My post above
You are of course quite right. Why only be concerned in ones own posts?
In the above for-loop your code takes about 1.78 seconds to complete, where acer's takes about 1.14.
First 51 52 53 54 55 56 57 Last Page 53 of 68