Clear Filters
Clear Filters

How to perform a coordinate transformation in a function?

26 views (last 30 days)
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?
John D'Errico
John D'Errico on 24 Dec 2023
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 on 24 Dec 2023
Edited: Kovács on 24 Dec 2023
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

Sign in to comment.

Accepted Answer

David Goodmanson
David Goodmanson on 24 Dec 2023
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 Comment
Kovács on 24 Dec 2023
Edited: Kovács on 24 Dec 2023
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

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!