How to perform a coordinate transformation in a function?

32 次查看(过去 30 天)
I want to perform a coordinate transformation on a ds square. I have never used MatLab before. I have entered the original expression, I will enter how the new coordinates depend on the original ones. Here I get stuck: how should I tell it to substitute into the ds square function?
  3 个评论
John D'Errico
John D'Errico 2023-12-24
This is not a question about knowing MATLAB, but a question of understanding what a coordinate transform means, and how you would "apply" such a thing.
For example, suppose you have coordinates, (x,y). Then you might wish to convert to polar coordinates. That is a coordinate transform. You can do so by a simple set of equations, or you can use the cart2pol function in MATLAB.
Even more simply, given coordinates (x,y), then the pair (x+1,y+2) is a coordinate transform, a simple translational one.
The problem is, we have no idea what you are doing, what transformation you would employ, or how you would use it in code. I could see cases where you might use the coordinate transform in a purely mathematical way, so before you write any code at all. Or it might become an essential part of your code.
You need to be far more clear if you want a useful answer.
Kovács
Kovács 2023-12-24
编辑:Kovács 2023-12-24
I understand, thank you for your response. To be more precise: there is a square of ds , used in relativity theory, which is a function with four variables (t, x, y, z), on the picture is (2). From this, I want to transform two variables in the following way, containing sine and cosine. So there will be two new coordinates, instead of x and t. The result should be the Rindler metric shown in (3). But as I tried it on paper, it didn't come out exactly that, on the other hand I would like to learn how to do this on a computer, since it is very often a similar calculation necessary in spacetime analysis. John D'Errico, Torsten

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2023-12-24
Hi Kovacs
Here is one way. Clearly
x^2 + t^2 = xi^2
by inspection, so that factor, which is common to both terms, can be saved till the end.
syms x t xi lam dxi dlam
x = xi*cos(lam)
t = xi*sin(lam)
dx = diff(x,lam)*dlam + diff(x,xi)*dxi
dt = diff(t,lam)*dlam + diff(t,xi)*dxi
ds2 = simplify((1/xi^2)*((-dt^2+dx^2)*(x^2-t^2) +4*x*t*(dx*dt)))
ds2 = - dlam^2*xi^2 + dxi^2
  1 个评论
Kovács
Kovács 2023-12-24
编辑:Kovács 2023-12-24
Thank you very much, David Goodmanson , excellent solution. I did it with the full expression according to this. The key is to use the "simplify" and "diff" commands. I learned a lot from it. Ideteszem az eredeti cikk forrását, ha érdekelne: TARDIS spacetime

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by