hendriksdf5

65 Reputation

4 Badges

1 years, 32 days

MaplePrimes Activity


These are questions asked by hendriksdf5

I am trying to set up a new tensor expression (r^hat is my unit vector):  

Can someone show me how to do it and/or point me to the right help page? 

The first part of the equation works but the rest does not. How do I get around the problem with the different indices? Another problem I have is that KroneckerDelta is no longer a tensor. Is there a way to define it as such?

with(Physics); Setup(mathematicalnotation = true)

with(Vectors)NULL

Setup(spacetimeindices = greek, spaceindices = lowercaselatin, su2indices = uppercaselatin, signature = `- - - +`, coordinates = cartesian)

[coordinatesystems = {X}, signature = `- - - +`, spaceindices = lowercaselatin, spacetimeindices = greek, su2indices = uppercaselatin]
````

(1)

Define(A[mu, a] = (1-fA(r))/(g*r)*(LeviCivita[a, nu, mu, 4]*X[nu]/r))

{R, A[mu, a], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(2)

A[]

A[mu, a] = Matrix(%id = 36893490522608139428)

(3)

Define(V[mu, a] = (1-fA(r))/(g*r)*(LeviCivita[a, nu, mu, 4]*X[nu]/r)-fB(r)*(KroneckerDelta[i, j]-X[i]*X[j]/r^2)/gr+fC(r)*X[i]*X[j]/(gr*r^2))

Error, (in Physics:-Define) found different free indices in different operands of a sum; in operand 1: [], in operand 2: [i, j], in `+`(Physics:-KroneckerDelta[i,j],-Physics:-SpaceTimeVector[i](x,y,z,t)*Physics:-SpaceTimeVector[j](x,y,z,t)/r^2)

 

NULL

Download V_Tensor.mw

I have calculated an expression which depends on functions. I would now like to calculate the derivative withe respect to a function  but when I try to do so I get the error “Deriving a functional ”Error, invalid input: diff received fA(r), which is not valid for its 2nd argument. There is no help page available for this error, so maybe someone knows what I am doing wrong .

I get this is because die diff function might not be able to handel a function as an argument, but how would I do it? 

L := -r^2*((-fA(r)^4+(-2*fB(r)^2-2*fC(r)^2+2)*fA(r)^2+4*(D(fB))(r)*fA(r)*fC(r)*r-fB(r)^4+(-2*fC(r)^2+2)*fB(r)^2-4*fB(r)*fC(r)*(D(fA))(r)*r-2*r^2*(D(fA))(r)^2-1-2*r^2*(D(fB))(r)^2)/(2*g^2*r^4)+(r*(fB(r)^2+(1/2)*fC(r)^2+fA(r)^2-2*fA(r)+1)*H(r)^2+(-(D(K))(r)*r^2*fC(r)-2*K(r)*fB(r)*r)*H(r)+(1/2)*K(r)^2*fC(r)^2*r+(D(H))(r)*K(r)*r^2*fC(r)+r*((fB(r)^2+fA(r)^2)*K(r)^2+(1/2)*r^2*((D(H))(r)^2+(D(K))(r)^2)))*v^2/(r^2)^(3/2)-lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2)

-r^2*((1/2)*(-fA(r)^4+(-2*fB(r)^2-2*fC(r)^2+2)*fA(r)^2+4*(D(fB))(r)*fA(r)*fC(r)*r-fB(r)^4+(-2*fC(r)^2+2)*fB(r)^2-4*fB(r)*fC(r)*(D(fA))(r)*r-2*r^2*(D(fA))(r)^2-1-2*r^2*(D(fB))(r)^2)/(g^2*r^4)+(r*(fB(r)^2+(1/2)*fC(r)^2+fA(r)^2-2*fA(r)+1)*H(r)^2+(-(D(K))(r)*r^2*fC(r)-2*K(r)*fB(r)*r)*H(r)+(1/2)*K(r)^2*fC(r)^2*r+(D(H))(r)*K(r)*r^2*fC(r)+r*((fB(r)^2+fA(r)^2)*K(r)^2+(1/2)*r^2*((D(H))(r)^2+(D(K))(r)^2)))*v^2/(r^2)^(3/2)-lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2)

(1)

diff(L, fA(r))

Error, invalid input: diff received fA(r), which is not valid for its 2nd argument

 
 

``

Download test_funtion.mw

I want to substitute a variable r' =sqrt(x^2 + y^2 + z^2).

But how do I change my output so that r' is displayed instead of sqrt(x^2+y^2+z^2)?

E.g. line (5) D(g)(r')x/r' and not D(g)(sqrt(x^2 + y^2 + z^2))*/sqrt(x^2 + y^2 + z^2). 

And one more question. How can I make sure that my output in (6) is only the result on the right side and the left side of the equal sign is not displayed? 


 

restart

with(Physics)

__________________________________________________________________

(1)

with(Vectors)``

Setup(spacetimeindices = greek, spaceindices = lowercaselatin, su2indices = uppercaselatin, signature = `- - - +`, coordinates = cartesian)

[coordinatesystems = {X}, signature = `- - - +`, spaceindices = lowercaselatin, spacetimeindices = greek, su2indices = uppercaselatin]

(2)

diff(r(x), x) := sqrt(x^2+y^2+z^2)

(x^2+y^2+z^2)^(1/2)

(3)

``

g(diff(r(x), x))

g((x^2+y^2+z^2)^(1/2))

(4)

diff(g(diff(r(x), x)), x)

(D(g))((x^2+y^2+z^2)^(1/2))*x/(x^2+y^2+z^2)^(1/2)

(5)

NULL

NULL

H := (x*Psigma[1, matrix]+y*Psigma[2, matrix]+z*Psigma[3, matrix]).Vector(2, {1 = 0, 2 = U(diff(r(x), x))})

(x*Physics:-Psigma[1]+y*Physics:-Psigma[2]+z*Physics:-Psigma[3]).Vector[column](%id = 36893490180036880732) = Vector[column](%id = 36893490180036881092)

(6)

NULL


 

Download representation_of_code.mw

What exactly is the difference between the differential operator d_[] from the physics package and diff() ? Why is it not possible for me to differentiate a scalar function g or a coordinate r with the help of the operator? d_[1] should correspond to d/dx (X = (x, y, z, t)) or not? 

restart

with(Physics)

with(Vectors)NULL

Setup(coordinates = cartesian)

[coordinatesystems = {X}]

(1)

r = sqrt(x^2+y^2+z^2)

r = (x^2+y^2+z^2)^(1/2)

(2)

d_[1](g(r))

0

(3)

diff(g(r), x)

(D(g))((x^2+y^2+z^2)^(1/2))*x/(x^2+y^2+z^2)^(1/2)

(4)

d_[1](r)

0

(5)

diff(r, x)

x/(x^2+y^2+z^2)^(1/2)

(6)

d_[1](x)

1

(7)

diff(x, x)

1

(8)

NULL

Download example_d_[].mw

I would like to solve this system of differential equations y_1 , y_2. However, there should be no exact solutions for this problem. Is there a way to get a numerical solution of such coupled equations in maple and if so, how? I know the dsolve() command, but it did not work here. The boundary conditions are f(0)-1 = K(0) = 0 and f'(inf) = K'(inf) = 0. It would be nice if someone could help me or tell me where to look to solve something like this.

restart

with(Physics)NULL

[coordinatesystems = {X}, signature = `+ + + -`, spaceindices = lowercaselatin, spacetimeindices = greek, su2indices = uppercaselatin]

(1)

``Setup(realobjects = {a, g, v, K(diff(rho(x), x)), f(diff(rho(x), x))})

[realobjects = {a, g, v, K(`rho'`), f(`rho'`)}]

(2)

-(`rho'`^2*(diff(K(`rho'`), `rho'`, `rho'`))+2*`rho'`*(diff(K(`rho'`), `rho'`))+K(`rho'`)*(K(`rho'`)^2*a*`rho'`^2*v^2+(1/2)*f(`rho'`)^2+(-2*`rho'`-1)*f(`rho'`)-a*v^2*`rho'`^2+2*`rho'`-3/2))*v^2 = 0

-(`rho'`^2*(diff(diff(K(`rho'`), `rho'`), `rho'`))+2*(diff(K(`rho'`), `rho'`))*`rho'`+K(`rho'`)*(K(`rho'`)^2*a*`rho'`^2*v^2+(1/2)*f(`rho'`)^2+(-2*`rho'`-1)*f(`rho'`)-a*v^2*`rho'`^2+2*`rho'`-3/2))*v^2 = 0

(3)

2*(diff(f(`rho'`), `rho'`, `rho'`))/g^2+(-4*f(`rho'`)^3+24*f(`rho'`)^2+(-`rho'`^2*v^2*g^2*K(`rho'`)^2-44)*f(`rho'`)+24+(2*(`rho'`+1/2))*g^2*`rho'`^2*v^2*K(`rho'`)^2)/(2*`rho'`^2*g^2) = 0

2*(diff(diff(f(`rho'`), `rho'`), `rho'`))/g^2+(1/2)*(-4*f(`rho'`)^3+24*f(`rho'`)^2+(-`rho'`^2*v^2*g^2*K(`rho'`)^2-44)*f(`rho'`)+24+2*(`rho'`+1/2)*g^2*`rho'`^2*v^2*K(`rho'`)^2)/(`rho'`^2*g^2) = 0

(4)

y_1 := -(`rho'`^2*(diff(diff(K(`rho'`), `rho'`), `rho'`))+2*`rho'`*(diff(K(`rho'`), `rho'`))+K(`rho'`)*(K(`rho'`)^2*a*`rho'`^2*v^2+(1/2)*f(`rho'`)^2+(-2*`rho'`-1)*f(`rho'`)-a*v^2*`rho'`^2+2*`rho'`-3/2))*v^2 = 0

-(`rho'`^2*(diff(diff(K(`rho'`), `rho'`), `rho'`))+2*(diff(K(`rho'`), `rho'`))*`rho'`+K(`rho'`)*(K(`rho'`)^2*a*`rho'`^2*v^2+(1/2)*f(`rho'`)^2+(-2*`rho'`-1)*f(`rho'`)-a*v^2*`rho'`^2+2*`rho'`-3/2))*v^2 = 0

(5)

y_2 := 2*(diff(diff(f(`rho'`), `rho'`), `rho'`))/g^2+(1/2)*(-4*f(`rho'`)^3+24*f(`rho'`)^2+(-`rho'`^2*v^2*g^2*K(`rho'`)^2-44)*f(`rho'`)+24+2*(`rho'`+1/2)*g^2*`rho'`^2*v^2*K(`rho'`)^2)/(`rho'`^2*g^2) = 0

2*(diff(diff(f(`rho'`), `rho'`), `rho'`))/g^2+(1/2)*(-4*f(`rho'`)^3+24*f(`rho'`)^2+(-`rho'`^2*v^2*g^2*K(`rho'`)^2-44)*f(`rho'`)+24+2*(`rho'`+1/2)*g^2*`rho'`^2*v^2*K(`rho'`)^2)/(`rho'`^2*g^2) = 0

(6)

NULL

Download coupled_deq.mw

1 2 Page 1 of 2