Published
Edited
Jun 18, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable mode = 0;
Insert cell
mutable mode_m = 0;
Insert cell
mutable g_x = 0
Insert cell
mutable g_t = 0
Insert cell
mutable m_x = 0
Insert cell
mutable m_t = 0
Insert cell
gamma = 1/Math.sqrt(1-v_m*v_m);
Insert cell
mutable g_xp = 0;
Insert cell
mutable m_xp = 0;
Insert cell
mutable m_tp = 0;
Insert cell
g_x_func = (x) => {
return x - v_g*g_t;
}
Insert cell
m_x_func = (x,t) => {
return gamma*(x - v_m*t);
}
Insert cell
m_t_func = (x,t) => {
return gamma*(t - v_m*x);
}
Insert cell
g_x_inv = (x) => {
return x + v_g*g_t;
}
Insert cell
m_x_inv = (x,t) => {
return gamma*(x + v_m*t);
}
Insert cell
g_t_inv = (t) => {
return t
}
Insert cell
m_t_inv = (x,t) => {
return gamma*(t + v_m*x)
}
Insert cell
event_x_g = () => {
if (mode == 0) {
return g_x;
} else {
return g_x_inv(g_xp);
}
}
Insert cell
event_x_m = () => {
if (mode_m == 0) {
return m_x;
} else {
return m_x_inv(m_xp, m_tp);
}
}
Insert cell
event_t_m = () => {
if (mode_m == 0) {
return m_t;
} else {
return m_t_inv(m_xp, m_tp);
}
}
Insert cell
event_xp_g = () => {
if (mode == 1) {
return g_xp;
} else {
return g_x_func(g_x);
}
}
Insert cell
event_xp_m = () => {
if (mode_m == 1) {
return m_xp;
} else {
return m_x_func(m_x, m_t);
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more