John Fredsted's blog

Using the procedure permsPosNeg as given in the blog entry Positive and negative permutations, including the improvement obtained in the blog entry Refactoring Maple code, consider the following procedure:

The recent thread A crossprod problem, although not directly related, inspired me to write this blog entry about bilinear cross products and their noticable property [see for instance P. Lounesto, Clifford Algebras and Spinors, 2nd ed. (Cambridge University Press, Cambridge, 2001)]:

Theorem: A bilinear cross product obeying the orthogonality property and the Pythagorean property, see below, exists only in 3 or 7 (real or complex) dimensions.

John Fredsted's picture

Using Maple for research

Inspired by Jacques' blog entry Introduction to transseries, concerning a paper by Gerald A. Edgar, using Maple and published at arXiv, I here take the liberty to refer to a recent paper of mine which also uses Maple and is published at arXiv. The link is:

Linking electroweak and gravitational generators.

Most probably, this paper would not have existed without the possibility of performing lots of calculations in Maple, using for instance my own package COSVAM which deals with the octonions, the largest division algebra over the reals.

For instance, the pivotal Eq. (5) of the paper would probably not have been discovered by me using pen and paper. It was accidentally discovered while performing some Maple calculations with a different objective in mind.

Second note added: The issue below seems to have been resolved by clearing the cache of my Firefox browser, i.e., it seems to have been purely a local problem.

John Fredsted's picture

Regions bounded by lines

Inspired by the blog post Find a point in every region defined by a system of linear equations, I have come up with the following method to find a point inside each bounded region. The assumptions are:

  • No two lines are parallel.
  • No three lines are coincident.

Due to numerical instability, it seems, using floats, the coefficients of the equations of the lines are taken to be integers (they could also have been taken to be fractions, of course). Then the method goes like follows:

I have written a module based Maple expressions to LaTeX converter which can handle the following nested (as given by ToInert) inert types:

_Inert_RATIONAL, _Inert_COMPLEX, _Inert_NAME, _Inert_SUM, _Inert_PROD, _Inert_POWER, _Inert_SET, _Inert_LIST, _Inert_FUNCTION, _Inert_MATRIX, _Inert_VECTOR_COLUMN, _Inert_VECTOR_ROW, _Inert_TABLEREF.

As a somewhat cruel test example consider

expr := Matrix(2,2,(i,j) ->
	-(-x)^(-i/2+c)*sin(x)^(-j)*(a+I*b)^((i-j)/2)
	+f({-i,j})/g([-i,j])
	+m[i,j]
);
newLatex:-Latex(expr);

which yields

Inspired by the post "finding the Hessian (third order tensor) and higher order derivatives", I have written the following function which treats gradients, Jacobians, Hessians, and higher order derivatives in a unified way, implementing tensors as multidimensional Arrays:

multiDiff := proc(expr::Array(algebraic),vars::list(symbol),n::posint)
   local i,result;
   if n > 1 then result := multiDiff(multiDiff(expr,vars,n - 1),vars,1)
   else
      result := Array(ArrayDims(expr),1..nops(vars),order = C_order);
John Fredsted's picture

The art of linking

Inspired by my own post The art of linking, I here bring an expanded version (I hope that it does not appear too self-centred to do so):

You can link to other parts of MaplePrimes, or 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 is located above the area where you enter your text, the result being

Inspired by the post Re: the physics package I decided to have a closer look at the function FeynmanDiagrams. As the Lagrangian I thought I might as well take the QED Lagrangian for a massless spinor field Q[i](X) coupled to an external electromagnetic field A[mu](X):

restart:
with(Physics):
Setup(advanced):
L_QED :=
   +Dagger(Q[i](X)) * Dgamma[4] * Dgamma[mu][i,j] * I * diff(Q[j](X),X[mu])
   +Dagger(Q[i](X)) * Dgamma[4] * Dgamma[mu][i,j] * e * A[mu](X) * (Q[j](X));
John Fredsted's picture

Expression trees

Note added: As correctly pointed out by Joe Riel in his post below, my function fromTree fails doing what it is supposed to do for expressions which contain lists and/or sets. For a version of fromTree which behaves properly (I believe) also for expressions containing lists and/or sets, see my post below.

Consider the following two functions:

toTree   := x -> `if`(op(x) = x,x,[op(0,x),map(toTree,[op(x)])[]]):
John Fredsted's picture

Plots of twisted ribbons

In order to get better acquainted with the plotting facilities of Maple I thought I would try to plot the Möbius strip. In the proces I generalized the task so that I would be able to plot a ribbon twisted an arbitrary number of times. From these efforts the following code resulted:

with(plots):
radiusVector := (phi) -> Vector([cos(phi),sin(phi),0]):
ribbonVector := (phi) -> Vector([-sin(phi)*cos(phi),-sin(phi)*sin(phi),cos(phi)]):
p := (twist,theTitle,theOrientation) -> plot3d(
   radiusVector(phi) + t*ribbonVector(twist*phi),phi=0..2*Pi,t=-0.3..0.3,
   title=theTitle,orientation=theOrientation,grid=[100,10],scaling=constrained
Syndicate content
}