John Fredsted

2243 Reputation

15 Badges

19 years, 266 days

MaplePrimes Activity


These are answers submitted by John Fredsted

Using limit, the summation may be evaluated at the requested point x = 0 for any number of addends (note n as the end-range of the q summation):

expr := (n::nonnegint) -> limit(sum(sum(x^(q-p),p = 0..q),q = 0..n),x = 0);
expr(10);                 # The value you ask for
seq(expr(n),n = 0..20);   # Some other values

I have taken the liberty to program the task myself. I would just write as follows:

with(Physics):
Setup(
   mathematicalnotation = true,
   Coordinates = (X = (t,r,theta,phi)),
   metric = exp(2*nu(r))*dt^2 - exp(2*lambda(r))*dr^2 - r^2*dtheta^2 - r^2*sin(theta)^2*dphi^2
):
Christoffel[~mu,nu,rho,nonzero];

I think the output tallies with the Christoffel symbols as given in the pdf-document you provide. You are probably quite aware of it, but remember to shift the indices by +1 when going from the pdf-source to the Maple output.

PS: Concerning your own worksheet, why do you load the tensor package, when you have already loaded the Physics package?; there is no need to do that, the superb GR-capabilities of the latter package being more than sufficient.

If matters of efficiency is no issue, then I would just do as follows:

primesInRange := (a::posint,b::posint) -> select(isprime,[$(a..b)]):
primesInRange(100,200);   # An example

Perhaps the command EulerLagrange in the VariationalCalculus package would be useful to you; type ?VariationalCalculus:-EulerLagrange for its help page. You could type something like

with(VariationalCalculus):
EulerLagrange(L,theta,[z(theta),v(theta)]);

PS: Does m(v) in your L actually mean m*v(theta)? If it does, then this must, of course, be corrected in order to obtain the correct equations of motion.

`or`(seq(`and`(seq(a[j] = b[j],j = 1..i-1),a[i] < b[i]),i = 1..100));

for your first case, where I assume that the a's and b's run from 1 to 100; and, as a subcase of that,

`and`(seq(a[j] = b[j],j = 1..99),a[100] < b[100]);

for your second case.

Use the command ChangeFrame. An example:

with(DifferentialGeometry):
DGsetup([x,y],M);                # Setting up frame M
Tools:-DGinfo("CurrentFrame");   # Frame has become M
DGsetup([u,v],N);                # Setting up frame N
Tools:-DGinfo("CurrentFrame");   # Frame has now changed to N
ChangeFrame(M):                  # Change back to frame M
Tools:-DGinfo("CurrentFrame");   # Check that the frame is now M again

This may be beside the point, but the removal of (any and all) abs can be performed simply as

rmabssq := (expr) -> eval(expr,abs = (x -> x)):
rmabssq(anexp);

the function replacing each occurrence of abs with the identity map.

Although perhaps not in the spirit of the question, the following considerations may be of interest: By applying the following implications

sin(x) = +/- 1/2*sqrt(2 + y) implies cos(2x) = -y/2,
cos(x) = +/- 1/2*sqrt(2 + y) implies cos(2x) = +y/2,

a couple of times, it readily follows that

cos(8*x1) = 1/2*sqrt(2),

from which, in turn, it follows that

8*x1 = +/- Pi/4 + n*2*Pi, or equivalently:
  x1 = Pi/32*(8*n +/- 1),

for n an integer. For n = 2 and the -1 option, the given value x1 = 15/32*Pi is recovered.

Second thoughts: Due to the above implications being only implications, not bi-implications, the solutions of cos(8*x1) = 1/2*sqrt(2) are in general not the solutions of the original arcsin-equation. For instance, letting n = 0 yields x1= +/- Pi/32, none of which satisfies the original equation. So perhaps the above considerations are not that useful after all.

The simplest way I know of is to enclose the code lines with (* ... *).

Using StringTools:

table([seq(ithprime(i) = convert(StringTools:-Char(i + 96),symbol),i = 1..26)]);

PS: I start with the association 2 = a, for why not use 'a' as well?

The following procedure extracts the minimum and maximum prime factors, respectively, of some integer:

getMinMax := proc(n::integer)
   local expr := map(x -> op([1,1],x),[op(ifactor(n))]);
   min(expr),max(expr);
end proc:

Example:

getMinMax(5^3*3^2*17*53^3);

If you rename phi to Phi, say, then the errors disappear. Mysterious! Any name other than phi seems to suffice.

The following procedure seems to do the requested job:

getParams := proc(expr::function)
   local s,r;
   s,r := selectremove(type,[op(expr)],function);
   if s <> [] then getParams(s[]),r[] else s[],r[] end if
end proc:
getParams(propositionsentence);

PS: The procedure can, of course, be used as well for nested functions other than the propositionsentence given.

I would recommend that you use the GR-capabilities of the much more recent Physics package. Here your calculation of the Kretschmann scalar of the Schwarzschild metric can be performed simply as follows:

with(Physics):
g_[sc];
Simplify(Riemann[mu,nu,rho,sigma]*Riemann[mu,nu,rho,sigma]);

PS: The g_[sc] command loads the Schwarzschild metric, see for instance Exact solutions to Einstein's equations.

There does indeed seem to be a problem. The result

Simplify(LeviCivita[4,mu,nu,alpha]*LeviCivita[4,mu,nu,beta]);

does not tally with the following 'manual' summation (remembering explicit metrics to raise two of the indices):

Matrix(4,4,(alpha,beta) -> add(add(
   g_[mu,mu]*g_[nu,nu]*LeviCivita[4,mu,nu,alpha]*LeviCivita[4,mu,nu,beta]
,mu = 1..4),nu = 1..4));

the matrix explicitly showing that nontrivial contributions to your sum can, of course, come only from the spatial components of q and qp. In comparison, the following triply contracted expression is correct/self-consistent:

Matrix(4,4,(alpha,beta) -> add(add(add(
   g_[mu,mu]*g_[nu,nu]*g_[rho,rho]*
   LeviCivita[mu,nu,rho,alpha]*
   LeviCivita[mu,nu,rho,beta]
,mu = 1..4),nu = 1..4),rho = 1..4));
Simplify(LeviCivita[mu,nu,rho,alpha]*LeviCivita[mu,nu,rho,beta]);

 

3 4 5 6 7 8 9 Last Page 5 of 19