DarkMath

125 Reputation

4 Badges

4 years, 175 days

MaplePrimes Activity


These are replies submitted by DarkMath

@vv Sagemath defines it that way. 

@Kitonum This doesn't work like a functional.

For example 

f(g(r)) ==> int(g(r),r)
f(h(r)) ==> int(h(r),r)
f(h(r+a)) ==> int(h(r+a),r)
f(z(r-b)) ==> int(z(r-b),r)

I found this

f(func)=Int(func,r)

This seems to work, but I have to delay the integral. 

@dglevitt

I am having the same problem. The result should be equal to 4piDiracdelta(r _r), but Maple is giving 0.

@Kitonum assume statement alone puts a worksheet-wide property to the variables. That's why I avoid it, but unfortunately, there seems to be no other way at the moment (at least to my knowledge) 

@nm Hmm..  I see what expand does... Thanks. This is a nice trick.

expand puts the following function 

f:=exp(-a)*(b + c)*1/k

into a nice form 

b*1/exp(a)*1/k + c*1/exp(a)*1/k

when I use subs like 

subs(exp(a)=p,expand(f))

it works very nicely with this trick

but 

subs(exp(a)*k=p,expand(f))

failed to substitute. Any trick with this one?

@rlopez Thank you for the explanation. I realized the difference between the unit vectors e (unbarred) with Vector and e- (barred) with VectorField. Let me think on this in this context for awhile. 

@tomleslie 

VectorCalculus:-PositionVector([r,0,0],spherical) gives you a vector (in cartesian basis)  in the direction of z with the magnitude of r which is only consistent with the mathematical definition of the position vector in spherical coordinates with a specific set of coordinates in spherical chart: r=r, th=0, ph=0 being expressed in cartesian basis.

So, what is being entered are not the components of the position vector in the spherical basis, but the coordinates in spherical chart. 

This is the reason why it gives [r*sin(th)*cos(ph), r*sin(th)*cos(ph), r*cos(th)] when the function is called with [r,th,ph] "coordinates" as in PositionVector([r,th,ph],spherical). 

If these were the components as said in the help file, the result should have been (th*cos(th)*cos(ph)+r*cos(ph)*sin(th)-ph*sin(ph))*e_x + (ph*cos(ph)+th*cos(th)*sin(ph)+r*sin(th)*sin(ph))*e_y + (r*cos(th)-th*sin(th))*e_z

Also asking for the "components" of a position vector doesn't make sense either. The components of the position vectors in a given coordinate system are already set (with root [0,0,0]). The only thing matters are the coordinates and as far as I have seen that's what PositionVector is doing. Just to clarify I don't have a problem with the function, I do have a problem with the help file. 

Update:

rlopez pointed an important representation matter. In that context, I need to think little further. 

Thank you for your help too. I greatly appreciate it. 

 

 

@tomleslie I saw the part that whatever coordinate system the PositionVector function is called in, it will be converted to cartesian coordinate system with [0,0,0] being the root. 

However,

I think (or I am unable to grasp) my problem is still there. Let me explain:

Look at the function,

VectorCalculus:-PositionVector([r,0,0], spherical);

If these are the components, the vector to be converted is (in spherical coordinates) 

r*e_r + 0*e_th + 0*e_ph

Now, the function converts this to cartesian coordinate system with [0,0,0] being the root. 

The conversion of this vector to cartesian coordinate system must be

[r*sin(th)*cos(ph), r*sin(th)*cos(ph), r*cos(th)]

by the virtue of the conversion of the unit vectors from spherical to cartesian

e_r= sin(th)*cos(ph)*e_x + sin(th)*sin(ph)*e_y + cos(th)*e_z
e_th=cos(th)*cos*ph)*e_x + cos(th)*sin(ph)*e_y - sin(th)*e_z
e_ph=-sin(ph)*e_x + cos(ph)*e_y + 0*e_z

But PositionVector function gives 

0*e_x + 0*e_y + r*e_z

Basically, [0,0,r]. So, this is NOT the conversion of the components from spherical to cartesian coordinate system.

 

This result is the result of  the conversion of r*e_r with the coordinates given as  [r,th,ph] to cartesian:

This can easily be seen by 

r*e_r=r*(sin(th)*cos(ph)*e_x + sin(th)*sin(ph)*e_y + cos(th)*e_z)

When r!=0, th=0, and ph=0,  this becomes [0,0,r].

So, the term "components" used in the help file still dilutes me :(

 

@Kitonum 

Ok, so it needs to be done manually then.  Honestly I was surprised to hear that this was not implemented. 

@ecterrab Thank you. It worked.

I see that vectors in Physics[Vectors] are defined as vector fields, is that correct?

If you are working topology, group theory, graph theory,etc.; then SageMath should be your number one choice. The developers of SageMath are matematicans from these fields. So, my recommendation would be that instead of choosing Maple to be your primary platform and tyring to link SageMath to Maple, go with SageMath and link Maple to it for this particular project of yours. Hence you will get the best of both.

@Carl Love Thanks. This is what I have been looking for. And also the code is very instructive.

@nm In SageMath you can.  So, generalizing "..there is no such thing, and there will never be such thing in CAS." is a very unfortunate statement.

You can input a 1st order differential equation as 

ode=-(x^2+x*y(x))*diff(x)+1*diff(y(x))==0

and it is a very valid statement. For me, It really doesn't matter how internally a CAS represents this. SageMath represents it as the following before it is sent to desolve

-x^2-x*y(x)+diff(y(x),x)==0

The bottom line is I shouldn't have to be forced to enter a differential equation in the derivative form. The differential form of a 1st order differential equation is a very common form one can see in any text book and I don't see why it shouldn't be in any CAS let alone Maple. 

 

@acer I don't actually need to use Pi/6 but just that Maple gave me that error somehow shattered my understanding of the way Maple handles vectors. But what I see is that this is a problem with Maple. Is it considered a bug?

@tomleslie No problem :)

1 2 Page 1 of 2