Items tagged with physics physics Tagged Items Feed

 

Symbolic sequences enter in various formulations in mathematics. This post is about a related new subpackage, Sequences, within the MathematicalFunctions package, available for download in Maplesoft's R&D page for Mathematical Functions and Differential Equations (currently bundled with updates to the Physics package).

 

Perhaps the most typical cases of symbolic sequences are:

 

1) A sequence of numbers - say from n to m - frequently displayed as

n, `...`, m

 

2) A sequence of one object, say a, repeated say p times, frequently displayed as

 "((a,`...`,a))"

3) A more general sequence, as in 1), but of different objects and not necessarily numbers, frequently displayed as

a[n], `...`, a[m]

or likewise a sequence of functions

f(n), `...`, f(m)

In all these cases, of course, none of n, m, or p are known: they are just symbols, or algebraic expressions, representing integer values.

 

These most typical cases of symbolic sequences have been implemented in Maple since day 1 using the `$` operator. Cases 1), 2) and 3) above are respectively entered as `$`(n .. m), `$`(a, p), and `$`(a[i], i = n .. m) or "`$`(f(i), i = n .. m)." To have computer algebra representations for all these symbolic sequences is something wonderful, I would say unique in Maple.

Until recently, however, the typesetting of these symbolic sequences was frankly poor, input like `$`(a[i], i = n .. m) or ``$\``(a, p) just being echoed in the display. More relevant: too little could be done with these objects; the rest of Maple didn't know how to add, multiply, differentiate or map an operation over the elements of the sequence, nor for instance count the sequence's number of elements.

 

All this has now been implemented.  What follows is a brief illustration.

restart

First of all, now these three types of sequences have textbook-like typesetting:

`$`(n .. m)

`$`(n .. m)

(1)

`$`(a, p)

`$`(a, p)

(2)

For the above, a$p works the same way

`$`(a[i], i = n .. m)

`$`(a[i], i = n .. m)

(3)

Moreover, this now permits textbook display of mathematical functions that depend on sequences of paramateters, for example:

hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[i], i = 1 .. q)], z)

hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[i], i = 1 .. q)], z)

(4)

IncompleteBellB(n, k, `$`(factorial(j), j = 1 .. n-k+1))

IncompleteBellB(n, k, `$`(factorial(j), j = 1 .. n-k+1))

(5)

More interestingly, these new developments now permit differentiating these functions even when their arguments are symbolic sequences, and displaying the result as in textbooks, with copy and paste working properly, for instance

(%diff = diff)(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[i], i = 1 .. q)], z), z)

%diff(hypergeom([`$`(a[i], i = 1 .. p)], [`$`(b[i], i = 1 .. q)], z), z) = (product(a[i], i = 1 .. p))*hypergeom([`$`(a[i]+1, i = 1 .. p)], [`$`(b[i]+1, i = 1 .. q)], z)/(product(b[i], i = 1 .. q))

(6)

It is very interesting how much this enhances the representation capabilities; to mention but one, this makes 100% possible the implementation of the Faa-di-Bruno  formula for the nth symbolic derivative of composite functions (more on this in a post to follow this one).

But the bread-and-butter first: the new package for handling sequences is

with(MathematicalFunctions:-Sequences)

[Add, Differentiate, Map, Multiply, Nops]

(7)

The five commands that got loaded do what their name tells. Consider for instance the first kind of sequences mentione above, i.e

`$`(n .. m)

`$`(n .. m)

(8)

Check what is behind this nice typesetting

lprint(`$`(n .. m))

`$`(n .. m)

 

All OK. How many operands (an abstract version of Maple's nops  command):

Nops(`$`(n .. m))

m-n+1

(9)

That was easy, ok. Add the sequence

Add(`$`(n .. m))

(1/2)*(m-n+1)*(n+m)

(10)

Multiply the sequence

Multiply(`$`(n .. m))

factorial(m)/factorial(n-1)

(11)

Map an operation over the elements of the sequence

Map(f, `$`(n .. m))

`$`(f(j), j = n .. m)

(12)

lprint(`$`(f(j), j = n .. m))

`$`(f(j), j = n .. m)

 

Map works as map, i.e. you can map extra arguments as well

MathematicalFunctions:-Sequences:-Map(Int, `$`(n .. m), x)

`$`(Int(j, x), j = n .. m)

(13)

All this works the same way with symbolic sequences of forms "((a,`...`,a))" , and a[n], `...`, a[m]. For example:

`$`(a, p)

`$`(a, p)

(14)

lprint(`$`(a, p))

`$`(a, p)

 

MathematicalFunctions:-Sequences:-Nops(`$`(a, p))

p

(15)

Add(`$`(a, p))

a*p

(16)

Multiply(`$`(a, p))

a^p

(17)

Differentation also works

Differentiate(`$`(a, p), a)

`$`(1, p)

(18)

MathematicalFunctions:-Sequences:-Map(f, `$`(a, p))

`$`(f(a), p)

(19)

MathematicalFunctions:-Sequences:-Differentiate(`$`(f(a), p), a)

`$`(diff(f(a), a), p)

(20)

For a symbolic sequence of type 3)

`$`(a[i], i = n .. m)

`$`(a[i], i = n .. m)

(21)

MathematicalFunctions:-Sequences:-Nops(`$`(a[i], i = n .. m))

m-n+1

(22)

Add(`$`(a[i], i = n .. m))

sum(a[i], i = n .. m)

(23)

Multiply(`$`(a[i], i = n .. m))

product(a[i], i = n .. m)

(24)

The following is nontrivial: differentiating the sequence a[n], `...`, a[m], with respect to a[k] should return 1 when n = k (i.e the running index has the value k), and 0 otherwise, and the same regarding m and k. That is how it works now:

Differentiate(`$`(a[i], i = n .. m), a[k])

`$`(piecewise(k = i, 1, 0), i = n .. m)

(25)

lprint(`$`(piecewise(k = i, 1, 0), i = n .. m))

`$`(piecewise(k = i, 1, 0), i = n .. m)

 

MathematicalFunctions:-Sequences:-Map(f, `$`(a[i], i = n .. m))

`$`(f(a[i]), i = n .. m)

(26)

Differentiate(`$`(f(a[i]), i = n .. m), a[k])

`$`((diff(f(a[i]), a[i]))*piecewise(k = i, 1, 0), i = n .. m)

(27)

lprint(`$`((diff(f(a[i]), a[i]))*piecewise(k = i, 1, 0), i = n .. m))

`$`((diff(f(a[i]), a[i]))*piecewise(k = i, 1, 0), i = n .. m)

 

 

And that is it. Summarizing: in addition to the former implementation of symbolic sequences, we now have textbook-like typesetting for them, and more important: Add, Multiply, Differentiate, Map and Nops. :)

 

The first large application we have been working on taking advantage of this is symbolic differentiation, with very nice results; I will see to summarize them in a post to follow in a couple of days.

 

Download MathematicalFunctionsSequences.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi,

     I was wondering if there is an easy way to define another set of indices in the Physics package. For example, usually greek indices are for all 4 spacetime dimensions. Using Setup(spaceindices = lowercaselatin), we can define 3 of those as space indices. I was hoping there is a more general command, so that I could use only 2 indices as "space indices". For example, X[i] would run over x,y while X[mu] would run over t, z. Is there such a command in the Physics package, or a simple way to implement this personally?

Second thing. I was playing with SumOverRepeatedIndices on an expression that contained both space indices and spacetime indices. Usually this seems to work, but in my attached example it does not. I tried the same thing with just spacetime indices in Maple 18 (newest Physics update) and it gave the same error.


Any help appreciated,

PhysicsBug.mw

Hi, I am learning GR and new to maple. I played with maple's DifferentialGeometry package.

While duplicated the maple GR example, in DGsetup([t, r, theta, phi], M1, verbose),

I got the error,

DGsetup([t, r, theta, phi], M1, verbose)

The following coordinates have been protected:
[t, r, theta, phi]


The following vector fields have been defined and protected:


Error, (in Typeset:-Tdisplay[true]) `alias` does not evaluate to a module

 

 I don't know how to fix it. Can anyone kindly help?

Thanks

 

 

 

 

 

 

 

Hello;

 

I wish to express a tensorial equation or expression a simplified vector form.

 

In the worksheet attached, I was trying to express Maxwell Equations in the familiar vector form from the tensorial form, using the F[mu,nu] tensor.

 

But I cannot achieve the familiar tensor form. If someone can give a hand, it would help me a lot.

 

HowtoExpressCompactForm.mw

 

 

how to generate random data from equations of electromagnetism?

Hi Edgardo/Others, 

I'm not sure if any more development work is being done on the physics package or not. But I've gotten back to playing around with the great tetrad package you've developed. 

Specfically, I'm calculating spin connections for various metrics. I've run into a few troubles, and have written a simple example showing some calculations that don't match my expectations. 

This is by no means urgent, and if you are no longer developing the package, you can ignore this post. 

Hopefully you can follow the code, I've commented on the issues I have, summary:

1. Checking the tetrads match the minkowski metric when contracted with the curved metric. 

2. I build a tensor Gamma_mu (represents spin connection for a covariant derivative) which contains non-commuting gamma matricies (ideally dirac gamma's). I then try and contract this tensor with another non commutating tensor (dirac gamma matrix) using SumOverRepeatedIndices(). Unless I'm mistaken, this function doesn't preserve the anticommuting nature of the tensor components. 

Cheers. 

Correcting_-_Tetrads.mw

r := sqrt(x^2+y^2+z^2);
divE := diff(e*x/(4*Pi*r^3), x)+diff(e*x/(4*Pi*r^3), y)+diff(e*x/(4*Pi*r^3),z);
simplify(divE);

Using with(Physics):

On an initial condition setting for using dsolve when I do D(theta)(0) it returns  0=0

I'll have to check tonight if it's a mistake on my part.  But perhaps that is supposed to happen.

guys , i have a metric and i want to define a componenets of a tensor and then obtain its covariant derivative with respect to a metric, what is your idea ?

N_1=-A(r)^1/2 , A_2=A_3=A_4=0 , what is D_[nu] N_1 =?

 in general i want to define N[1]=-A(r)^(1/2) and N[2] = N[3]= N[3] = N[4] = 0 And define F[mu, nu] = 2*(D_[mu] N[nu]-D_[nu] N[mu]) And define Omega[mu, nu] = 2*(D_[mu] N[nu]+D_[nu] N[mu]) and compute expression F_[alpha, beta] F_[~alpha`, ~beta ] And N_[alpha] N_[~beta`] F_[ ~alpha, ~lambda ] Omega_[beta, lambda])

i have problem with this how to difine this tensorial terms and how to compute them.

Covariant.mw

 

thxxxx

Some of the Rotation Coefficients are not calculating properly.

Question_about_Ricci_Rotation_Coefficients.mw

 

 

Hi!

 

I was trying to obtain the field equations for the QED Lagrangian and I was not sucessfull.

 

All my calculations are equal to 0.

 

Can someone give a hand?

 

QED.mw

 

Thanks a lot.

guys, is there any possibility to obtain field equations of einstein-hilbert action?

best regards

 

Dear all
I am using Physics[Vectors] package of Maple 17. I want to define an orthogonal curvilinear coordinates through alpha and beta independent variables. To define unit vectors of alpha and beta, I have to apply the derivatives of position vector r_ with respect to alpha and beta, respectively. Please help me to define the unit vectors in directions alpha and beta as derivatives of position vector r_ with respect to alpha and beta, respectively. Please see the below Code:


> restart;

> with(Physics[Vectors]);

> Setup(mathematicalnotation=true);

> r_:=X(alpha,beta)*_i+Y(alpha,beta)*_j+Z(alpha,beta)*_k;


The unit vectors in directions alpha and beta should be defined as:

_alpha=diff(r_,alpha)
_beta=diff(r_,beta)

It is worthwhile to mention that the following expression governs:


> diff(r_,alpha).diff(r_,beta)=0;

 

Please guide me.

Best wishes

Ali

with(Physics) :
t:=Intc(Dirac(k1+k2+k3)*phi(k1)*phi(k2)*phi(k3),k1,k2,k3) ;


# how to force
Fundiff(t,phi(-k));

# to find
3*Intc(Dirac(k2+k3-k)*phi(k2)*phi(k3),k2,k3) ;

 

The physics package is pretty awesome, but one thing that would be a big help is some functionality for entering and resolving vectors in angle/magnitude format (50 angle 45 degrees, or what have you.) Is there a way to do this?

 

Thanks

 

Joe

1 2 3 4 5 6 7 Last Page 1 of 10