text:
# modwtmra

Multiresolution analysis based on MODWT

## Description

example

mra = modwtmra(w) returns the multiresolution analysis (MRA) of the maximal overlap discrete wavelet transform (MODWT) matrix, w. The MODWT matrix, w, is the output of the modwt function. By default, modwtmra assumes that you obtained w using the 'sym4' wavelet with periodic boundary handling.

example

mra = modwtmra(w,wname) constructs the MRA using the wavelet corresponding to wname. The wname wavelet must be the same wavelet used to obtain the MODWT.

example

mra = modwtmra(w,Lo,Hi) constructs the MRA using the scaling filter Lo and wavelet filter Hi. The Lo and Hi filters must be the same filters used to obtain the MODWT.

example

mra = modwtmra(___,'reflection') uses the reflection boundary condition in the construction of the MRA using any of the arguments from previous syntaxes. If you specify 'reflection', modwtmra assumes that the column dimension of w is even and equals twice the length of the original signal.

You must enter the entire character vector 'reflection'. If you added a wavelet named 'reflection' using the wavelet manager, you must rename that wavelet prior to using this option. 'reflection' may be placed in any position in the input argument list after x. By default, modwtmra uses periodic extension at the boundary.

## Examples

collapse all

Obtain the MODWTMRA of a simple time-series signal and demonstrate perfect reconstruction.

Create a time-series signal

t = 1:10;
x = sin(2*pi*200*t);

Obtain the MODWT and the MODWTMRA and sum the MODWTMRA rows.

m = modwt(x);
mra = modwtmra(m);
xrec = sum(mra);

Use the maximum of the absolute values to show that the difference between the original signal and the reconstruction is extremely small. The largest absolute value is on the order of $1{0}^{-25}$, which demonstrates perfect reconstruction.

max(abs(x-xrec))
ans = 5.5738e-25

Construct an MRA of an ECG signal down to level four using the db2 wavelet. The data are taken from Percival & Walden (2000), p.125 (data originally provided by William Constantine and Per Reinhall, University of Washington). The sampling frequency for the ECG signal is 180 hertz.

lev = 4;
wtecg = modwt(wecg,'db2',lev);
mra = modwtmra(wtecg,'db2');

Plot the ECG waveform and the MRA.

t = (0:numel(wecg)-1)/180;
subplot(6,1,1)
plot(t,wecg)
for kk = 2:lev+2
subplot(6,1,kk)
plot(t,mra(kk-1,:))
end
xlabel('Time (s)')
set(gcf,'Position',[0 0 500 700])

Construct a multiresolution analysis for the Southern Oscillation Index data. The sampling period is one day. Plot the level eight details corresponding to a scale of ${2}^{8}$ days. The details at this scale capture oscillations on a scale of approximately one year.

wtsoi = modwt(soi);
mrasoi = modwtmra(wtsoi);
plot(mrasoi(8,:))
title('Level 8 Details')

Obtain the MRA for the Deutsch Mark - U.S. Dollar exchange rate data using the minimum bandwidth scaling and wavelet filters with four coefficients.

Lo = [0.4801755, 0.8372545, 0.2269312, -0.1301477];
Hi = qmf(Lo);
wdm = modwt(DM_USD,Lo,Hi);
mra = modwtmra(wdm,Lo,Hi);

Obtain the MRA for an ECG signal using 'reflection' boundary handling. The data are taken from Percival & Walden (2000), p.125 (data originally provided by William Constantine and Per Reinhall, University of Washington).

wtecg = modwt(wecg,'reflection');
mra = modwtmra(wtecg,'reflection');

Show that the number of columns in the MRA is equal to the number of elements in the original signal.

isequal(size(mra,2),numel(wecg))
ans = logical
1

Load the 23 channel EEG data Espiga3 [3]. The channels are arranged column-wise. The data is sampled at 200 Hz.

Obtain the MRA of the multisignal.

w = modwt(Espiga3);
mra = modwtmra(w);

This example demonstrates the differences between the functions MODWT and MODWTMRA. The MODWT partitions a signal's energy across detail coefficients and scaling coefficients. The MODWTMRA projects a signal onto wavelet subspaces and a scaling subspace.

Choose the sym6 wavelet. Load and plot an electrocardiogram (ECG) signal. The sampling frequency for the ECG signal is 180 hertz. The data are taken from Percival and Walden (2000), p.125 (data originally provided by William Constantine and Per Reinhall, University of Washington).

t = (0:numel(wecg)-1)/180;
wv = 'sym6';
plot(t,wecg)
grid on
title(['Signal Length = ',num2str(numel(wecg))])
xlabel('Time (s)')
ylabel('Amplitude')

Take the MODWT of the signal.

wtecg = modwt(wecg,wv);

The input data are samples of a function $f\left(x\right)$ evaluated at $N$-many time points. The function can be expressed as a linear combination of the scaling function $\varphi \left(x\right)$ and wavelet $\psi \left(x\right)$at varying scales and translations: $f\left(x\right)=\sum _{k=0}^{N-1}{c}_{k}\phantom{\rule{0.16666666666666666em}{0ex}}{2}^{-{J}_{0}/2}\varphi \left({2}^{-{J}_{0}}\phantom{\rule{0.16666666666666666em}{0ex}}x-k\right)+\sum _{j=1}^{{J}_{0}}{f}_{j}\left(x\right)$ where ${f}_{j}\left(x\right)=\sum _{k=0}^{N-1}{d}_{j,k}\phantom{\rule{0.16666666666666666em}{0ex}}{2}^{-j/2}\phantom{\rule{0.16666666666666666em}{0ex}}\psi \left({2}^{-j}x-k\right)$ and ${J}_{0}$ is the number of levels of wavelet decomposition. The first sum is the coarse scale approximation of the signal, and the ${f}_{j}\left(x\right)$ are the details at successive scales. MODWT returns the $N$-many coefficients $\left\{{c}_{k}\right\}$and the $\left({J}_{0}×N\right)$-many detail coefficients $\left\{{d}_{j,k}\right\}$ of the expansion. Each row in wtecg contains the coefficients at a different scale.

When taking the MODWT of a signal of length $N$, there are $\text{floor}\left({\mathrm{log}}_{2}\left(N\right)\right)$-many levels of decomposition (by default). Detail coefficients are produced at each level. Scaling coefficients are returned only for the final level. In this example, since $N=2048$, ${J}_{0}=\text{floor}\left(\mathrm{log}2\left(2048\right)\right)=11$ and the number of rows in wtecg is ${J}_{0}+1=11+1=12$.

The MODWT partitions the energy across the various scales and scaling coefficients: ${||X||}^{2}=\sum _{j=1}^{{J}_{0}}{||{W}_{j}||}^{2}+{||{V}_{{J}_{0}}||}^{2}$ where $X$ is the input data, ${W}_{j}$ are the detail coefficients at scale $j$, and ${V}_{{J}_{0}}$ are the final-level scaling coefficients.

Compute the energy at each scale, and evaluate their sum.

energy_by_scales = sum(wtecg.^2,2);
Levels = {'D1';'D2';'D3';'D4';'D5';'D6';'D7';'D8';'D9';'D10';'D11';'A11'};
energy_table = table(Levels,energy_by_scales);
disp(energy_table)
Levels     energy_by_scales
_______    ________________

{'D1' }         14.063
{'D2' }         20.612
{'D3' }         37.716
{'D4' }         25.123
{'D5' }         17.437
{'D6' }         8.9852
{'D7' }         1.2906
{'D8' }         4.7278
{'D9' }         12.205
{'D10'}         76.428
{'D11'}         76.268
{'A11'}         3.4192
energy_total = varfun(@sum,energy_table(:,2))
energy_total=table
sum_energy_by_scales
____________________

298.28

Confirm the MODWT is energy-preserving by computing the energy of the signal and comparing it with the sum of the energies over all scales.

energy_ecg = sum(wecg.^2);
max(abs(energy_total.sum_energy_by_scales-energy_ecg))
ans = 7.4402e-10

Take the MODWTMRA of the signal.

mraecg = modwtmra(wtecg,wv);

MODWTMRA returns the projections of the function $f\left(x\right)$ onto the various wavelet subspaces and final scaling space. That is, MODWTMRA returns $\sum _{k=0}^{N-1}{c}_{k}\phantom{\rule{0.16666666666666666em}{0ex}}{2}^{-{J}_{0}/2}\varphi \left({2}^{-{J}_{0}}\phantom{\rule{0.16666666666666666em}{0ex}}x-k\right)$and the ${J}_{0}$-many $\left\{{f}_{j}\left(x\right)\right\}$evaluated at $N$-many time points. Each row in mraecg is a projection of $f\left(x\right)$ onto a different subspace. This means the original signal can be recovered by adding all the projections. This is not true in the case of the MODWT. Adding the coefficients in wtecg will not recover the original signal.

Choose a time point, add the projections of $f\left(x\right)$ evaluated at that time point and compare with the original signal.

time_point = 1000;
abs(sum(mraecg(:,time_point))-wecg(time_point))
ans = 3.0846e-13

Confirm that, unlike MODWT, MODWTMRA is not an energy-preserving transform.

energy_ecg = sum(wecg.^2);
energy_mra_scales = sum(mraecg.^2,2);
energy_mra = sum(energy_mra_scales);
max(abs(energy_mra-energy_ecg))
ans = 115.7053

The MODWTMRA is a zero-phase filtering of the signal. Features will be time-aligned. Demonstrate this by plotting the original signal and one of its projections. To better illustrate the alignment, zoom in.

plot(t,wecg,'b')
hold on
plot(t,mraecg(4,:),'-')
hold off
grid on
xlim([4 8])
legend('Signal','Projection','Location','northwest')
xlabel('Time (s)')
ylabel('Amplitude')

Make a similar plot using the MODWT coefficients at the same scale. Note that features will not be time-aligned. The MODWT is not a zero-phase filtering of the input.

plot(t,wecg,'b')
hold on
plot(t,wtecg(4,:),'-')
hold off
grid on
xlim([4 8])
legend('Signal','Coefficients','Location','northwest')
xlabel('Time (s)')
ylabel('Amplitude')

## Input Arguments

collapse all

MODWT transform of a signal or multisignal down to level LEV, specified as a matrix or 3-D array, respectively. w is an LEV+1-by-N matrix for the MODWT of an N-point signal, and an LEV+1-by-N-by-NC array for the MODWT of an N-by-NC multisignal. By default, imodwt assumes that you obtained the MODWT using the 'sym4' wavelet with periodic boundary handling.

Data Types: single | double
Complex Number Support: Yes

Synthesis wavelet, specified as a character vector or string scalar. The synthesis wavelet must be the same wavelet used to obtain the MODWT with the modwt function.

Filters, specified as a pair of even-length real-valued vectors. Lo is the scaling filter, and Hi is the wavelet filter. Lo and Hi must be the same filters used in the analysis with modwt. The filters must satisfy the conditions for an orthogonal wavelet. The lengths of Lo and Hi must be equal. See wfilters for additional information. You cannot specify both a wavelet wname and filter pair Lo,Hi.

Scaling filter, specified as an even-length real-valued vector. You can specify Lo only if you do not specify wname. Lo must be the same scaling filter used to obtain the MODWT with the modwt function.

## Output Arguments

collapse all

Multiresolution analysis, returned as a matrix or 3-D array. mra is a LEV+1-by-N matrix or LEV+1-by-N-by-NC array where LEV is the level of the MODWT and N is the length of the analyzed signal. The kth row of mra contains the details for the kth level. The (LEV+1)th row of mra contains the LEVth level smooth.

By default, mra is the same size as the input w. If you specify reflection boundary handling, then mra has one half the size of the column dimension as the input w.

## References

[1] Percival, Donald B., and Andrew T. Walden. Wavelet Methods for Time Series Analysis. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge ; New York: Cambridge University Press, 2000.

[2] Whitcher, Brandon, Peter Guttorp, and Donald B. Percival. “Wavelet Analysis of Covariance with Application to Atmospheric Time Series.” Journal of Geophysical Research: Atmospheres 105, no. D11 (June 16, 2000): 14941–62. https://doi.org/10.1029/2000JD900110.

[3] Mesa, Hector. “Adapted Wavelets for Pattern Detection.” In Progress in Pattern Recognition, Image Analysis and Applications, edited by Alberto Sanfeliu and Manuel Lazo Cortés, 3773:933–44. Berlin, Heidelberg: Springer Berlin Heidelberg, 2005. https://doi.org/10.1007/11578079_96.

## Extended Capabilities

### Apps

Introduced in R2015b

Get trial now


text:
What direction does 0° in the J2000 epoch point towards on January 1, 2000?

We are searching data for your request:

Forums and discussions:
Manuals and reference books:
Data from registers:
Wait the end of the search in all databases.
Upon completion, a link will appear to access the found materials.

Is 0 degrees in the J2000 Epoch 'right ascension' is a line from Earth to the sun on January 1, 2000? Or is 0 degrees the direction towards the ascending node 'equinox'? Which is NOT towards the Sun on January first…

Or is 0 degrees the direction towards the ascending node 'equinox'? Which is NOT towards the Sun on January first…

The answer is yes, more or less. From JPL's HORIZONS, the location of the Sun at Noon Terrestrial Time on 1 Jan 2000 is, ignoring atmospheric effects, a right ascension of 18 hours, 45 minutes, and 9.36 seconds. This is nowhere close to a right ascension of zero hours (or 24 hours, same thing).

The right ascension of the Sun with respect to the center of the Earth is zero at the March equinox.

What direction does 0° in the J2000 epoch point towards on January 1, 2000? - Astronomy

1. GEI: Geocentric Equatorial Inertial system. This system has X-axis pointing from the Earth toward the first point of Aries (the position of the Sun at the vernal equinox). This direction is the intersection of the Earth's equatorial plane and the ecliptic plane and thus the X-axis lies in both planes. The Z-axis is parallel to the rotation axis of the Earth, and y completes the right-handed orthogonal set (Y = Z * X). Geocentric Inertial (GCI) and Earth-Centered Inertial (ECI) are the same as GEI.

2. GEO: Geographic coordinate system. This system is defined so that its X-axis is in the Earth's equatorial plane but is fixed with the rotation of the Earth so that it passes through the Greenwich meridian (0 longitude). Its Z-axis is parallel to the rotation axis of the Earth, and its Y-axis completes a right handed orthogonal set (Y = Z * X).

3. GM: Geomagnetic coordinate system. Z-axis points to the Geomagnetic north pole (in Greenland). The positive X-axis points towards the great circle encompassing the North and South Geomagetic poles and lies in the geomagnetic equatorial plane in the segment that is in the western hemisphere. (The South GM pole is the antipode of the North GM pole.) Earth-centered Dipole is invoked. Y completes the triad.

4. GSE: Geocentric Solar Ecliptic system. This has its X-axis pointing from the Earth toward the Sun and its Y-axis is chosen to be in the ecliptic plane pointing towards dusk (thus opposing planetary motion). Its Z-axis is parallel to the ecliptic pole. Relative to an inertial system this system has a yearly rotation.

5. GSM: Geocentric Solar Magnetospheric system. This has its X-axis from the Earth to the Sun. The Y-axis is defined to be perpendicular to the Earth's magnetic dipole so that the X-Z plane contains the dipole axis. The positive Z-axis is chosen to be in the same sense as the northern magnetic pole. The difference between the GSM and GSE systems is simply a rotation about the X-axis.

6. SM: Solar Magnetic coordinates. In this system, the Z-axis is chosen parallel to the north magnetic pole and the Y-axis perpendicular to the Earth-Sun line towards dusk. The difference between this system and the GSM system is a rotation about the Y-axis. The amount of rotation is simply the dipole tilt angle. We note that in this system the X-axis does not point directly at the Sun. As with the GSM system, the SM system rotates with both a yearly and daily period with respect to inertial coordinates.

7. Invariant Latitude: For any point in space one can trace a B-field line to the Earth surface, assuming it is a centered dipole field. The GM latitude of this foot point is labelled as the Invariant Latitude along the entire field line. The dipole L-value is closely related to this invariant latitude L=1/(Cos(Lat))^2, and physically connotes the distance (in Earth radii) of the "top of the field line" from Earth center.

8. J2000: Geocentric Equatorial Inertial for epoch J2000.0 (GEI2000), also known as Mean Equator and Mean Equinox of J2000.0 (Julian date 2451545.0 TT (Terrestrial Time), or 2000 January 1 noon TT, or 2000 January 1 11:59:27.816 TAI or 2000 January 1 11:58:55.816 UTC.) This system has X-axis aligned with the mean equinox for epoch J2000 Z-axis is parallel to the rotation axis of the Earth, and Y completes the right-handed orthogonal set.

Equinox and Epoch

The word epoch denotes a particular point in time. In this sense the word has the same meaning in astronomy as it has in day-to-day life. For example, epoch J2000 means the time corresponding to the Julian date 2451545.0 in the concerned time system. In the Gregorian calendar this is 2000/1/1 12:00:00.

If we record the coordinates of a comet on 2011/11/11 11:11:11 UTC in the Gregorian calendar, then the epoch of the coordinates is 2011/11/11 11:11:11 UTC, or equivalently the Julian date 2455876.966099537 UTC. At a different time i.e., epoch, say 2011/11/11 22:22:22, the comet would have moved some distance and will have a different set of coordinates.

Due to precession the reference point for celestial coordinates, the vernal equinox, is continuously changing. So when specifying coordinates of a body we need to specify the location of the vernal equinox, which then fixes the orientation of the coordinate system. We do this by mentioning that the coordinate system is defined by the location of the vernal equinox at a particular time. This time i.e., epoch is referred to as the equinox of the coordinates.

In catalogs, we usually find entries such as (RA, DE) equinox J2000 epoch J2000. This means that the given (RA, DE) is the coordinate of the star at the time J2000 (epoch J2000), in the coordinate system defined by the vernal equinox at the time J2000 (equinox J2000).

If the star has proper motion, then we need to apply proper motion from J2000 to the epoch of interest to get the position of the star at this time. If the epoch of interest is 2010/10/10, then the epoch of the coordinates after applying proper motion from J2000 to 2010/10/10, is 2010/10/10, but its equinox remains at J2000.

Going back to the example of the comet, assume that the coordinates were measured using the known equinox J2000 positions of stars in an image. In this situation, the equinox of the comet’s coordinates is J2000, but its epoch is the time of observation i.e., 2011/11/11 11:11:11.

Suppose we want to point a telescope at the comet, at the time 2011/11/11 12:00:00. Then we need to take the coordinates at equinox J2000 epoch 2011/11/11 11:11:11, apply proper motion to find the coordinates at equinox J2000 epoch 2011:11:11 12:00:00, then precess the equinox from J2000 to 2011:11:11 12:00:00 to get the position at equinox 2011/11/11 12:00:00 epoch 2011/11/11 12:00:00, and then convert (RA, DE) to (Azimuth, Elevation).

To flog a dead horse, we precess from one equinox to the next but we apply proper motion from one epoch to the next.

The modern celestial coordinate system, ICRS, does not refer to the vernal equinox, and its reference axes are fixed in space. Due to this coordinates in the ICRS system do not have an associated equinox. They only have an epoch.

Standard epoch

Standard epoch: a date and time that specifies the reference system to which celestial coordinates are referred. Prior to 1984 coordinates of star catalogs were commonly referred to the mean equator and equinox of the beginning of a Besselian year (see year, Besselian).

standard epoch Particular date and time chosen as a reference point against which to measure astronomical data in order to remove the effects of precession, proper motion and gravitational perturbation. The standard epoch currently in use is called 2000.

The standard epoch in use today is Julian epoch J2000.0. It is exactly 12:00 TT (close to but not exactly Greenwich mean noon) on January 1, 2000 in the Gregorian (not Julian) calendar. Julian within its name indicates that other Julian epochs can be a number of Julian years of 365.25 days each before or after J2000.0.

The root mean square deviation from the arithmetic mean. [H76]

of observation for the catalog. The catalog data is most precise for this date, and becomes gradually less precise for dates in the past and future. Note that ALL THE POSITIONS ARE STILL IN THE J2000 COORDINATE SYSTEM.

Due to precession, this point moves over time, so positions of stars in catalogues and on atlases are usually referred to a "mean equator and equinox" of a specified

Right Ascension (RA) in hours and minutes, and Declination (DEC) in degrees and minutes, are given for the current

J2000.0, now used for new star-position catalogues and in solar-system-orbital calculations, means 2000 Jan. 1.5 Barycentric Dynamical Time (TDB) = Julian Date 2451545.0 TDB. When this dynamical, artificial "Julian year" is employed, a letter "J" prefixes the year.

declination of every star changes gradually, as the entire reference system rotates. For this reason, when citing the coordinates of a star, it is essential to specify the instant in time for which they are valid. This is known as the epoch of the coordinates. Star catalogues are usually compiled for a

basis"a small angle, but one that nevertheless must be taken into account in high-precision astronomical measurements. Rather than deal with slowly changing coordinates for every object in the sky, astronomers conventionally correct their observations to the location of the vernal equinox at some

Geocentric systems

The following coordinate systems at the centre of the Earth.

1. Systems based on the Earth's rotation axis

1.1 Geographic (GEO)

This system has its Z axis parallel to the Earth's rotation axis (positive to the North) and its X axis towards the intersection of the Equator and the Greenwich Meridian. Thus it is convenient for specifying the location of ground stations and ground-based experiments as these are fixed quantities in the GEO system.

A note of warning. When GEO coordinates are expressed in spherical form, the latitude component is identical what is termed geocentric latitude by astronomers and geographers. However, note that this is different to the system of geodetic latitude used in normal map-making. The geodetic latitude at any location is the angle between the equatorial plane and the local normal to the Earth's surface. In general that normal is NOT parallel to a radius vector because the shape of the Earth is an oblate spheroid and not a sphere.

1.2 Geocentric equatorial inertial (GEI)

This system has its Z axis parallel to the Earth's rotation axis (positive to the North) and its X axis towards the First Point of Aries (the direction in space defined by the intersection between the Earth's equatorial plane and the plane of its orbit around the Sun (the plane of the ecliptic). This system is (to first order) fixed with respect to the distant stars. It is convenient for specifying the orbits (and hence location) of Earth-orbiting spacecraft as one can specify a Keplerian orbit in this frame.

However note that the GEI system is subject to second order change with time owing to the various slow motions of the Earth's rotation axis with respect to the fixed stars. Thus for GEI coordinates one must specify the date (normally termed the epoch ) to which the coordinate system applies. For space physics work one should use the epoch-of-date GEI system, i.e. the system applying at the same time as the data were taken. (Thus the rotation axis in GEI is identical with the GEO rotation axis.) On these pages the unqualified acronym GEI refers to the epoch-of-date system. See Hapgood (1995) for a more detailed discussion of this issue.

1.3 Geocentric equatorial inertial for epoch J2000.0 (GEI 2000 )

Spacecraft orbits and locations are often made available in geocentric equatorial inertial coordinates for a fixed epoch, e.g. the standard astronomical epoch known as J2000.0 , which is 12:00 UT on 1 January 2000. We treat this as a separate coordinate system (with the qualified acronym GEI 2000 ) and specify how to transform from this to other systems.

2. Systems based on the Earth-Sun line

2.1 Geocentric solar ecliptic (GSE)

This system has its X axis towards the Sun and its Z axis perpendicular to the plane of the Earth's orbit around the Sun (positive North). This system is fixed with respect to the Earth-Sun line. It is convenient for specifying magnetospheric boundaries. It has also been widely adopted as the system for representing vector quantities in space physics databases.

2.2 Geocentric solar magnetospheric (GSM)

This system has its X axis towards the Sun and its Z axis is the projection of the Earth's magnetic dipole axis (positive North) on to the plane perpendicular to the X axis. The direction of the geomagnetic field near the nose of the magnetosphere is well-ordered by this system. Thus it is considered the best system to use when studying the effects of interplanetary magnetic field components (e.g. B z ) on magnetospheric and ionospheric phenomena.

3. Systems based on the dipole axis of the Earth's magnetic field

3.1 Solar magnetic (SM)

This system has its Z axis parallel to the Earth's magnetic dipole axis (positive North) and its Y axis perpendicular to the plane containing the dipole axis and the Earth-Sun line (positive in direction opposite to the Earth's orbital motion). The direction of the geomagnetic field in the outer magnetosphere is well-ordered by this system. It is the preferred system for defining magnetic local time in the outer magnetosphere.

3.2 Geomagnetic (MAG)

This system has its Z axis parallel to the Earth's magnetic dipole axis (positive North) and its Y axis is the intersection between the Earth's equator and the geographic meridian 90 degrees east of the meridan containing the dipole axis.

Additional Sun Systems

J2000_Ecliptic. The mean ecliptic system evaluated at the J2000 epoch. The mean ecliptic plane is defined as the rotation of the J2000 XY plane about the J2000 X axis by the mean obliquity defined using FK5 IAU76 theory. In the Vector Geometry Tool, this system is listed as SunMeanEclpJ200.

TrueEclipticOfDate. The true ecliptic system, evaluated at each given time. The true ecliptic plane is defined as the rotation of the J2000 XY plane about the J2000 X axis by the true obliquity defined using FK5 IAU76 theory.

Appendix A. Background Material

The Toolkit directly supports three time systems. They are

1. Coordinated Universal Time (UTC)

2. Barycentric Dynamical Time (TDB) also called Ephemeris Time (ET)

3. Spacecraft Clock Time (SCLK---pronounced ess clock'')

Coordinated Universal Time (UTC)

International Atomic Time (TAI)

Before discussing Coordinated Universal Time we feel it is helpful to talk about International Atomic Time (TAI or atomic time). Atomic time is based upon the atomic second as defined by the oscillation of the undisturbed cesium atom.'' Atomic time is simply a count of atomic seconds that have occurred since the astronomically determined instant of midnight January 1, 1958 00:00:00 at the Royal Observatory in Greenwich, England. Atomic time is kept by the International Earth Rotation Service (IERS, formally the Bureau International L'Heure---BIH) in Paris, France. The National Bureau of Standards and the U.S. Naval Observatory set their clocks by the clock maintained by the IERS.

Naming the seconds of TAI --- UTC

Coordinated Universal Time is a system of time keeping that gives a name to each instant of time of the TAI system. These names are formed from the calendar date and time of day that we use in our daily affairs. They consist of 6 components: year, month, day, hour, minutes and seconds. The year, month and day components are the normal calendar year month and day that appear on wall calendars. The hours component may assume any value from 0 through 23. The minutes component may assume any value from 0 to 59. The seconds will usually (but not always) range from 0 to 59.999. . The hour-minute-second string

is midnight and is the first instant of the calendar day specified by the first three components of the UTC time.

In the SPICE system UTC times are represented by character strings. These strings contain: year, month, day, hour, minute and second separated by delimiters (spaces or punctuation marks). The various delimiters and substrings between the delimiters are called the tokens of the string. A typical time string looks like

The tokens of the string and the associated UTC time components are

The link between any token and its corresponding UTC component is determined by examining the values of the tokens and comparing them to the other tokens. The precise rules used are spelled out in great detail in Appendix B. For now, simply be assured that the following five strings all mean the same thing and are interpreted in the same way by SPICE Toolkit software.

Tying UTC to the Earth's Rotation

The names given to TAI instants by the UTC system are governed by the earth's rotation. Ideally, UTC strings having hours, minutes and seconds components all zero should correspond to Greenwich midnight as determined by the observations of the transits of stars (the time system known as UT1). However, since the rotation of the earth is not uniform, this ideal cannot be realized. The difference between Greenwich midnight observed astronomically and UTC midnight is almost never zero. However, to keep the difference from becoming too large, UTC is occasionally adjusted so that the difference between the two midnights never exceeds .9 seconds. Thus from a knowledge of UTC one can always compute UT1 to better than 1 second accuracy.

Leapseconds

When Greenwich UT1 midnight lags behind UTC midnight by more than 0.9 seconds the IERS will announce that a leap second will be added to the collection of UTC names. This leap second has traditionally been added after the last normal'' UTC name of December 31 or June 30. Thus when a UTC second is added the hours-minutes-seconds portion of the UTC name progresses as shown here

instead of the usual progression

Should Greenwich UT1 midnight run ahead of UTC midnight by more than 0.9 seconds the IERS will announce a negative leap second. In this case one of the usual UTC hours-minutes-seconds triples will be missing from the list of UTC names. In this case the progression will be:

Since 1972 when leap seconds and the UTC system were introduced, a negative leap second has not occurred.

The Leapseconds Kernel (LSK)

The primary difficulty with UTC strings is that it is not possible to predict which atomic times will correspond to times during a UTC leap second. Thus algorithms for converting between UTC and time systems that simply use a continuous set of numeric markers require knowledge of the location of leap seconds in the list of names. This is the purpose of the LEAPSECONDS kernel supplied with the Toolkit. To convert between UTC times and any other system, you must first load the leapseconds kernel via a call to the routine FURNSH.

LSK files conform to a flexible format called NAIF text kernel'' format. The SPICE file identification word provided by itself on the first line of an LSK file is KPL/LSK''. Both the NAIF text kernel format and SPICE file identification word are described in detail in the Kernel Required Reading document, kernel.req.

Ephemeris Time (ET)

Ephemeris time is the uniform time scale represented by the independent variable in the differential equations that describe the motions of the planets, sun and moon. There are two forms of ephemeris time: Barycentric Dynamical Time (TDB) and Terrestrial Dynamical Time (TDT). Although they represent different time systems, these time systems are closely related.

Barycentric Dynamical Time (TDB)

Barycentric dynamical time is used when describing the motion of bodies with respect to the solar system barycenter.

Terrestrial Dynamical Time (TDT)

Terrestrial dynamical time is used when describing motions of objects near the earth. As far as measurements have been able to detect, TDT and TAI change at the same rate. Thus the difference between TDT and TAI is a constant. It is defined to be 32.184 seconds. At the zero point of TAI, TDT has a value of 32.184.

The Relationship between TDT and TDB

TDB is believed to be in agreement with the time that would be kept by an atomic clock located at the solar system barycenter. A comparison of the times kept by a clock at the solar system barycenter with a TDB clock on earth would reveal that the two clocks are in close agreement but that they run at different rates at different times of the year. This is due to relativistic effects.

At some times in the year the TDT clock appears to run fast when compared to the TDB clock, at other times of the year it appears to run slow. Let TDB0 be some fixed epoch on the TDB clock and TDT0 be a fixed epoch on the TDT clock (TDB0 and TDT0 do not necessarily have to be the same epoch). Any epoch, EPOCH, can be represented in the following ways: as the number of seconds TDB(EPOCH), that have elapsed since TDB0 on the TDB clock or as the number of seconds, TDT(EPOCH), that have elapsed since TDT0 on the TDT clock. If we plot the differences TDB(EPOCH) - TDT(EPOCH) against TDB(EPOCH) over all epochs, we will find that the graph is very close to a periodic function.

In SPICE the difference between TDT and TDB is computed as follows:

where K is a constant, and E is the eccentric anomaly of the heliocentric orbit of the Earth-Moon barycenter. This difference, which ignores small-period fluctuations, is accurate to about 0.000030 seconds. Thus to five decimal places the difference between TDT and TDB is a periodic function with magnitude approximately 0.001658 seconds and period equal to one sidereal year.

The eccentric anomaly E is given by

where EB and M are the eccentricity and mean anomaly of the heliocentric orbit of the Earth-Moon barycenter. The mean anomaly is in turn given by

where t is the epoch TDB expressed in barycentric dynamical seconds past the epoch of J2000.

The values K, EB, M0, and M1 are retrieved from the kernel pool. These are part of the leapseconds kernel. They correspond to the kernel pool variables'' DELTET/K, DELTET/EB, and DELTET/M. The nominal values are:

In the Toolkit ET Means TDB

When ephemeris time is called for by Toolkit routines, TDB is the implied time system. Software that converts between the various time systems described here use TDB whenever ephemeris time is called for. We call this time ET. (You can convert a UTC time string to TDT times, but you must make two subroutine calls instead of one.)

Ephemeris time is given in terms of seconds past a reference epoch. The reference epoch used throughout the Toolkit is the epoch J2000 (roughly noon on January 1, 2000). Using the Toolkit software, you can find out how many seconds the J2000 epoch is from right now.

Naming the Seconds of Ephemeris Time

Although ephemeris time is a formal time, within the limits of measurements it coincides with atomic time. As such we should be able to relate it to the expressions of time that we use everyday.

However, ephemeris time is described as a count of ephemeris seconds past the ephemeris reference epoch (J2000). For most of us the expression

bears little relationship to the time system we use to organize our lives. For this reason, it is common to give names to the various ephemeris seconds in a manner analogous to the UTC naming of the seconds of TAI---as a calendar date and time of day. The above string corresponds to

There is an important distinction between the names given to ephemeris seconds and the names used by the UTC system. The names assigned to ephemeris times never have leap seconds. The seconds' component of the name is restricted to and includes all values from 0 to 59.999. . Thus the time string above does not represent the same moment in time as does 1990 FEB 1 21:44:11 (UTC)'' There are two reasons. First, ephemeris time is ahead of atomic time by 32.184 seconds. Second, when a leap second occurs UTC strings fit an extra name into the sequence of valid UTC names. Thus it appears that UTC names fall behind ET names by a second after each leapsecond. At the present time UTC time strings appear to be 62.184 seconds behind ET time strings. This appearance is due to the fact that the two naming conventions are not the same. They simply have a lot of names in common.

It is both fortunate and unfortunate that there is a huge set of common names between calendar dates ET and calendar dates UTC. Since there are relatively few leapseconds, a time given by an ET name is always close to the time in the UTC system having the same name. Thus for planning observations, you can know what day the observation will take place, whether or not you are likely to need a coat and how to arrange your daily activities around the observation. But for precise work you must pay attention to the difference between the two times systems. If in planning the observation of a stellar occultation by an asteroid the difference between the two naming systems is neglected, it is likely that the observation will be missed.

The routine STR2ET will convert an ephemeris calendar date to seconds past the ephemeris epoch J2000.

Some Consequences of Leapseconds

There is no way of predicting when future leapseconds will occur. Normally you can predict whether there will be a leapsecond in the next few months, but beyond this predictions of leapseconds are not reliable. As a result we cannot say with certainty when a particular future UTC epoch will occur. For example, suppose you have a timer that you can set to beep'' after some number of seconds have passed. If this timer counts seconds perfectly without loosing or gaining time over decades, you cannot set it today to beep at midnight (00:00:00) January 1 (UTC) ten years from now---the number of leapseconds that will occur in the next ten years is not known. On the other hand, it is possible to set the timer so that it will beep at midnight January 1 (TDB). The TDB system does not have leapseconds. It is only necessary to know an algorithm (such as STR2ET) for converting calendar epochs TDB to seconds past some reference epoch in order to determine how to set the timer to beep at the correct epoch.

Any given Leapseconds Kernel will eventually become obsolete. Sometime after the creation of any Leapseconds Kernel there will be new leapseconds. When future leapseconds occur the old Leapseconds Kernel will no longer correctly describe the relationship between UTC, TDT and TDB for epochs that follow the new leapsecond. However, for epochs prior to the new leapsecond, the old kernel will always correctly describe the relationship between UTC, TDT and TDB.

Computing UTC from TDB (DELTET)

Below are a few epochs printed out in calendar format in both the TDT and UTC time systems.

At least in October 1996, it's clear that if you have either TDT or UTC you can construct the corresponding representation for the same epoch in the UTC or TDT system by simply subtracting or adding 62.184 seconds.

If you don't worry about what happens during a leapsecond you can express the above idea as:

For all epochs except during UTC leapseconds the above expression makes sense. DeltaTDT is simply a step function increasing by one after each leapsecond. Thus DeltaTDT can be viewed as a step function of either UTC or TDT.

If you rearrange this expression, you can get

Since, TDT can be expressed as seconds past J2000 (TDT), the above expression indicates the UTC can be expressed as some count of seconds. This representation is referred to by the dubious name of UTC seconds past J2000.'' If you write down the UTC calendar time string corresponding to an epoch and count the number of seconds between that calendar expression and the UTC calendar expression January 1, 2000 12:00:00'' and ignore leapseconds, you get the value of UTC in the expression above.

In practice this expression is broken down as follows:

The value DeltaTA is a constant, its value is nominally 32.184 seconds. DeltaTA is a step function. These two variables appear in the leapseconds kernel.

If we combine equation [6] above with equation [1] from the section The Relationship between TDT and TDB'' we get the following expression

This last value is called DeltaET and is computed by the SPICE routine DELTET. The various values that are used in the computation of DeltaET are contained in the Leapseconds Kernel. Indeed, a Leapseconds Kernel consists of precisely the information needed to compute DeltaET. Below is a sample Leapseconds kernel.

Although NAIF recommends against it, you could modify this file to alter the conversion. For example, until 1985 JPL's Orbit Determination Program (ODP) set used a value of 32.1843817 for DeltaTA, and some older CRS tapes were created using this value in the conversion from TAI to TDT. The value returned by DELTET can be made compatible with these tapes by replacing the current value (32.184, exactly) with the older value. Also, JPL'S Optical Navigation Program (ONP) set does not use the periodic term (K sin E) of the difference TDB-TDT. Setting the value of K to zero eliminates this term.

Problems With the Formulation of DeltaET

As we pointed out above, the expression ( TDT - UTC ) is meaningful as long as you stay away from leapseconds. If you write down the TDT and UTC representations for an epoch that occurs during a leapsecond you will have something like this:

Given these two epochs, it is no longer clear what we should assign to the value TDT - UTC. Thus although equation [7] above provides a simple expression for computing the difference between UTC and TDB'', the expression fails to tell us how to convert between TDB (or TDT) and UTC during leapseconds. For this reason the SPICE system does not use DeltaET when converting between TDB (or TDT) and UTC. Instead, the table of offsets corresponding to DeltaAT in the leapseconds kernel is converted to an equivalent table as shown below.

where the day number associated with a particular calendar date is the integer number of days that have passed since Jan 01, 0001 A.D. (on the extended Gregorian Calendar).

Given an epoch to be converted between UTC and some other time system (call this other system S'), we decompose the conversion problem into two parts:

1. converting between UTC and TAI,

2. converting between TAI and system S.

To convert between TAI and UTC, we examine the above table to determine whether or not the epoch in question falls on a day containing a leapsecond or during a day that is 86400 seconds in length. Once the length of the day associated with the epoch has been determined, the conversion from UTC to TAI (or from TAI to UTC) is straight forward. (See the routine TTRANS for details.) Having settled the problem of converting between TAI and UTC, the conversion between TAI and system S is carried out using the analytic expressions (equations [1], [2] and [3]) given above.

Spacecraft Clock (SCLK)

Most spacecraft have an onboard clock. This clock controls the times at which various actions are performed by the spacecraft and its science instruments. Observations are usually tagged with the spacecraft clock time when the observations are taken.

Each spacecraft clock can be constructed differently. For Galileo the SPICE spacecraft clock times looks like

When asking for the matrix which describes the pointing for some structure or instrument used to perform an observation, you will usually request this information by supplying the spacecraft clock string that was used to tag the observation. This string must usually be related to UTC or ET. Consequently it is necessary to load a file of spacecraft clock coefficients'' that enables SPICE software to transform the spacecraft clock string into one of the other time systems. This file of spacecraft clock coefficients is loaded with the routine FURNSH.

A more detailed discussion of Spacecraft Clock is contained in the Required Reading file sclk.req that is included with the SPICE Toolkit.

Julian Date

The Julian date system is a numerical time system that allows you to easily compute the number of days between two epochs. NAIF recognizes two types of Julian dates. Julian Ephemeris Date (JED) and Julian Date UTC (JDUTC). As with calendar dates used for ephemeris time and calendar dates UTC, the distinction between the two systems is important. The names of the two systems overlap, but they correspond to different moments of time.

Julian Ephemeris Date is computed directly from ET via the formula

where J2000 is a constant function that returns the Julian Ephemeris Date of the reference epoch for ET, and SPD is a constant function that gives the number or seconds per day.

Julian Date UTC has an integer value whenever the corresponding UTC time is noon.

We recommend against using the JDUTC system as it provides no mechanism for talking about events that might occur during a leapsecond. All of the other time systems discussed can be used to refer to events occurring during a leap second.

The abbreviation JD

Julian date is often abbreviated as JD.'' Unfortunately, the meaning of this string depends upon context. For example, the SPICE routine UTC2ET treats the string 2451821.1928 JD'' as Julian Date UTC. On the other hand, the SPICE routine TPARSE treats the same string as Julian Date TDB. Consequently, for high accuracy work, you must be sure of the context when using strings labeled in this way. Unless context is clear, it's usually safer to label Julian Date strings with one of the unambiguous labels: JDUTC, JDTDB, or JDTDT.

Data Provider Groups

Data can be requested in a variety of coordinate systems, where the origin of the coordinate system is the object's central body. The available coordinate systems depend on the object's central body. Nominally, the systems Fixed, Inertial, J2000, TrueOfDate, and MeanOfDate are supported, although some central bodies (notably the Earth and Sun) have more.

The following lists the systems available for Earth.

NameDescription
ICRFInternational Celestial Reference Frame. The ICRF axes are defined as the inertial (i.e., kinematically non-rotating) axes associated with a general relativity frame centered at the solar system barycenter (often called the BCRF).
MeanOfDateThe mean equator mean equinox coordinate system evaluated at the requested time.
MeanOfEpochThe mean equator mean equinox coordinate system evaluated at the epoch of the object.
TrueOfDateThe true equator true equinox coordinate system evaluated at the requested time.
TrueOfEpochThe true equator true equinox coordinate system evaluated at the epoch of the object.
B1950The mean equator mean equinox coordinate system evaluated at the beginning of the Besselian year 1950 (31 December 1949 22:09:46.866 = JD 2433282.4234591).
TEMEOfEpochThe true equator mean equinox coordinate system evaluated at the epoch of the object.
TEMEOfDateThe true equator mean equinox coordinate system evaluated at the requested time.
AlignmentAtEpochThe non-rotating coordinate system coincident with the Fixed system evaluated at the object's coordinate reference epoch.
J2000The mean equator mean equinox coordinate system evaluated at the J2000.0 epoch (2000 January 1.5 TDB = JD 2451545.0 TDB).

What direction does 0° in the J2000 epoch point towards on January 1, 2000? - Astronomy

The following conventions apply to facilitate the coordination of science planning, expedite the exchange of data between different instrument teams, and enhance the overall science activities.

The SOHO On Board Time (OBT) will use the CCSDS format, level 1 (TAI reference, 1958 January 1 epoch), as discussed in section 3.3.9 of the SOHO Experiment Interface Document Part A (Issue 1). The SOHO OBT is an unsegmented time code with a basic time equal to 1 second and a value representing the number of seconds from 1 January 1958 based on International Atomic Time. The OBT Pulse is adjusted to maintain the OBT within 20ms of the ground TAI.

The SOHO OBT is used to time tag the data packets sent to the EOF and to the Data Distribution Facility (DDF). The time tags for the spacecraft and instrument housekeeping packets are generated by the spacecraft on-board data handling system. The time tags for the instrument science data packets are inserted by the instruments generating the science data. The time tags will be provided in 6 bytes the first 4 bytes are TAI seconds (2 to 2 seconds) and the last 2 bytes are fractions of a second with the resolution of the On Board Time Pulse (2 seconds).

The SOHO Daily Pulse is generated every 86,400 seconds, and is synchronized to the TAI with an accuracy better than 100ms. The Daily Pulse will correspond to the beginning of a TAI day'', that is the Daily Pulse will occur at the zeros of TAI modulo 86,400. As of 1 January 1993, the difference between TAI midnight and 00:00 UTC was 27 seconds. Since July 1 1993 UTC-TAI = --28sec (TBC).

The helioseismology experiments plan to center one minute observations on the TAI minute, that is where TAI modulo 60 is zero.

Coordinated Universal Time (UTC) will be used as the operational time reference in the Experiment Operations Facility. The SOHO operations day'' is defined to begin at 00:00 UTC and the computer systems in the SMOCC and EOF will be synchronized to run on UTC.

The solar rotation axis will be calculated using the Carrington ephemeris elements. These elements define the inclination of the solar equator to the ecliptic as 7.25 degrees, and the longitude of the ascending node of the solar equator on the ecliptic as , where T is the time in years from J2000.0.

The solar rotation axis used for alignment of the SOHO spacecraft will be determined from the Carrington ephemeris elements. The Experiment Interface Document Part A (Issue 1, Rev 3) lists the longitude of the ascending node of the solar equator as 75.62 and the position of the pole of the solar equator in celestial coordinates as 286.11 right ascension and 63.85 declination. This definition is consistent with a solar rotation axis determined from the Carrington elements for a date of 1 January 1990. As mentioned in the EID Part A, this information must be updated for the actual launch date.

Heliographic longitudes on the surface of the Sun are measured from the ascending node of the solar equator on the ecliptic on 1 January 1854, Greenwich mean noon, and are reckoned from 0 to 360 in the direction of rotation. Carrington rotations are reckoned from 9 November 1853, 00:00 UT with a mean sidereal period of 25.38 days, and are designated as CR etc..

The spacecraft optical axes are defined with respect to the optical alignment cube of the Fine Pointing Sun Sensor, with the optical X axis (X ) nominally perpendicular to the spacecraft launcher separation plane and pointing from the separation ring through the spacecraft. The spacecraft optical Y axis (Y ) is along the direction of the solar panel extension with positive Y pointing from the interior of the spacecraft towards the UVCS instrument.

The orientation of the SOHO spacecraft is planned to have the spacecraft optical X axis (X ) pointing towards the photometric center of the Sun, and the spacecraft optical Z axis (Z ) oriented towards the north ecliptic hemisphere such that the (X ,Z ) plane contains the Sun axis of rotation. As such the Y axis will be parallel to the solar equatorial plane pointing towards the east (opposite to the solar rotation direction). ESA will be responsible for achieving this orientation with the misalignment margins defined in the EID-A.

A standard coordinate system is required for joint observations between instruments on the ground (for test purposes) and in space. This system, designated (X ,Y ), will be defined as follows: On the ground, the Y axis is parallel to the spacecraft Z axis and the X axis is anti-parallel to the spacecraft Y axis. In space, the (Y ,Z ) system is however no longer accessible. We will therefore define a virtual system (Y ,Z ), which is nominally coincident with (Y ,Z ) and where Y is perfectly aligned with the solar equator and its origin is at the Sun centre, and define (X ,Y ) in space as above using the virtual system (Y ,Z ).

The inter-instrument flag system (X ,Y ) thus has its origin at the Sun centre, its Y axis is in the plane containing the solar rotation axis pointing north, and its X axis positive towards the west limb. Each instrument participating in the flag exchange is reponsible for determining its orientation with respect to the (X ,Y ) system and report the coordinates of their observations in (X ,Y ) coordinates in units of 2 arcsec. Off-limb observations need special treatment if X , Y >1022''.

The Orbit data will describe the position and motion of the spacecraft, and it will be available in several coordinate systems including: geocentric inertial (GCI) coordinates for the J2000 system geocentric solar ecliptic (GSE) geocentric solar magnetospheric (GSM) coordinates and Heliocentric Ecliptic coordinate system.

The GSE coordinate system is defined as follows: The origin is Earth centered, with the X axis pointing from the center of the Earth to the center of the Sun the Y axis lies in the ecliptic plane and points in the opposite direction of the Earth's orbital motion the Z axis completes a right-handed orthogonal coordinate system and is parallel to the ecliptic pole. The Sun position is the true instantaneous'' position rather than the apparent'' (light-time delayed or aberrated) position. The ecliptic is the true ecliptic of date.

The Heliocentric Ecliptic coordinate system is defined as follows: the origin is Sun centered, with the Z axis parallel to the ecliptic pole with positive north of the ecliptic plane the X-Y plane lies in the ecliptic plane and the X axis points towards the first point of Aries the Y axis completes a right-handed orthogonal coordinate system.

The GCI coordinate system is defined as follows: Earth centered, where the X axis points from the Earth towards the first point of Aries (the position of the Sun at the vernal equinox). This direction is the intersection of the Earth's equatorial plane and the ecliptic plane --- thus the X axis lies in both planes. The Z axis is parallel to the rotation axis of the Earth and the Y axis completes a right-handed orthogonal coordinate system. As mentioned above, the X axis is the direction of the mean vernal equinox of J2000. The Z axis is also defined as being normal to the mean Earth equator of J2000.

The GSM coordinate system is defined as follows: again this system is Earth centered and has its X axis pointing from the Earth towards the Sun. The positive Z axis is perpendicular to the X axis and paralle to the projection of the negative dipole moment on a plane perpendicular to the X axis (the northern magnetic pole is in the same hemisphere as the tail of the magnetic moment vector). Again this is a right-handed orthogonal coordinate system.

Epoch & Unix Timestamp Conversion Tools

The unix time stamp is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch. It should also be pointed out (thanks to the comments from visitors to this site) that this point in time technically does not change no matter where you are located on the globe. This is very useful to computer systems for tracking and sorting dated information in dynamic and distributed applications both online and client side.

Human Readable Time Seconds
1 Hour 3600 Seconds
1 Day 86400 Seconds
1 Week 604800 Seconds
1 Month (30.44 days) 2629743 Seconds
1 Year (365.24 days) 31556926 Seconds

format: plain


text:
Cosmological constant theories

Are there any hypotheses on the expansion of the universe, which have a cosmological constant, or some other parameter, that results in a universe with an ever increasing rate of acceleration for the expansion of space time?

• Well, there's the currently accepted theory, $\Lambda CDM$. It uses a cosmological constant and the expansion of the universe asymptotically approaches an exponential. So that fits the parameters – Jim Mar 27 '15 at 19:10
• Ok, that has the hubble constant, which seems to have a constant acceleration and therefore an exponentialy increasing velocity for spacetime expansion. What about a case where da/dt>0? – Poemandres SugarKane Humblehof Mar 27 '15 at 19:20
• No, $a(t)=e^{Ht}$ asymptotically, which means that $\dot a(t)$, $\ddot a(t)$, and so on are all increasing too. Exponentially increasing velocity means the acceleration has to be exponentially increasing too – Jim Mar 27 '15 at 19:22
• i've always thought it interesting that, when expressed in a consistent set of units, that $\Lambda \approx 3 \Omega_\lambda H^2$. in Planck units, $H\approx 10^{-61}$ and $\Lambda \approx 10^{-122}$. seems as if there is a link between the observed Hubble constant and the cosmological constant. – robert bristow-johnson Mar 27 '15 at 21:17
• – Yukterez Mar 28 '15 at 0:21


text:
# Why is $\{\#F\mid\mathcal{N}\models F \text{ and$F$is an$\exists$-formula} \}$ a recursive set?

Let $$\mathcal{N}=(\mathbb{N},+,\cdot,0,1)$$. I want to show that $$\{\#F\mid\mathcal{N}\models F \text{ and F is an \exists-formula} \}$$ is a recursive set. Here $$\#F$$ is the Gödel number of $$F$$ and I think that $$\exists$$-formula just means a formula on the form $$\exists v_0 \dots\exists v_n F$$, without any occurrence of universal quantifiers. The problem is from an old mock-exam from a second-level logic course given at my university.

This was my original attempt, which, as Carl Mummert pointed out, is clearly wrong:

My idea is to show that $$\{\#F\mid\mathcal{N}\models F \}$$ is recursive and then just multiply its characteristic funtion with something like $$f(x)=\left[1\,\dot{-}\,sg(\vert \beta_3^3(x)-7\vert )\right]$$, i.e. something that takes the Gödel number of $$x$$ and returns $$0$$ if the last digit is not $$7$$ and $$1$$ if it is (i.e. if it is an $$\exists$$-formula). That would give me the characteristic funtion for the original set. But then my problem is that I don't know how to show that $$\{\#F\mid\mathcal{N}\models F \}$$ is recursive.

• The set of true formulas of arithmetic - $\{ \#\phi : \mathbb{N} \vDash \phi\}$ - is very far from being recursive. So that method will not work. Instead you would need to look at the special structure of a $\exists$ formula and use that to show that there is a way specific to those formula to tell if they are true. – Carl Mummert Jan 15 at 16:58
• You could improve the post by adding a little more background. What book is the problem from? What is your specific definition of a $\exists$ formula? – Carl Mummert Jan 15 at 16:59
• Yes of course, now that you phrase it that way... The problem is from an old mock-exam from a logic course given at my university. Now, unfortunately this is the first time I see the term "$\exists$-formula" but I am assuming they just mean that it is on the form $\exists v_0 G$. But thanks, I'll add that to my question. – KurtKnödel Jan 15 at 17:07
• \mid produces the correct spacing. – Asaf Karagila Jan 15 at 18:09
• Are you sure the text you got the problem from intended you to show the set is recursively decidable, rather than recursively enumerable (which is semidecidable) ? – DanielV Jan 15 at 21:10

It's not recursive.

Whether this is easy or very hard to show depends on exactly what "$$\exists$$-sentence" means. Specifically, the issue is whether "bounded quantifiers" (like $$\forall x<5$$, $$\exists y) are permitted. Formulas of the form $$\exists x_1,...,x_n G$$ where $$G$$ uses only bounded quantifiers are called "$$\Sigma_1$$" (or "$$\Sigma^0_1$$"); to me, "$$\exists$$-formula" sounds like a stronger condition, namely we require that the matrix $$G$$ be genuinely quantifier-free (and this is your interpretation in the comments above).

But in each case, the resulting set is non-recursive.

Showing that the $$\Sigma_1$$ theory of $$\mathcal{N}$$ is non-recursive isn't too hard. There is a $$\Sigma_1$$ formula $$Halt(x)$$ such that for each $$n\in\mathbb{N}$$ we have $$\mathcal{N}\models Halt(\underline{n})$$ iff $$\varphi_n(n)\downarrow$$ - writing "$$\varphi_e(x)\downarrow$$" for "the $$e$$th Turing machine halts on input $$x$$" and "$$\underline{k}$$" for the numeral corresponding to $$k$$ - but this means that the $$\Sigma_1$$-theory of $$\mathcal{N}$$ is at least as complicated as (in fact, it's equivalent to) the halting problem, which is non-recursive.

Gauging the complexity of the genuinely $$\exists$$-theory of $$\mathcal{N}$$ is harder, but ultimately still the same. This is the MRDP theorem: that the set of Diophantine equations with solutions (which is about as $$\exists$$ as it gets) is non-recursive, and in fact has complexity again equal to that of the halting problem.

• Thank you very much for this! This explains why it's been so hard to prove it... Actually, the original problem was to show that $\{F\,\vert\,\mathcal{N}\models F \text{ and$F$is an$\exists$-formula} \}\cup PA$ is an incomplete theory. Do you reckon this is still possible (using the first incompleteness theorem), despite the theory not being recursive? – KurtKnödel Jan 15 at 17:56
• @KurtKnödel Ah, that's a very different problem. It is indeed correct, and I have two hints. $(1)$ For a "nuke," use Craig's trick and the strong version of GIT ("no consistent recursively axiomatizable extensionof PA is complete"). $(2)$ For the optimal solution, show that PA already proves every true $\exists$-sentence, so you don't even need strong GIT. – Noah Schweber Jan 15 at 17:58
• Your second suggestion was actually my idea all along, but then somewhere someone mentioned recursive sets and I just lost it at that point. Thank you for clarifying things! – KurtKnödel Jan 15 at 18:06


text:
# C++ Beginner Bunny Exercise

I recently completed (somewhat) an exercise I found on a C++ forum. The exercise is found at the end of the list of exercises and is called "Graduation" and is about bunnies in a linked list.

Write a program that creates a linked list of bunny objects. Each bunny object must have

• Sex: Male, Female (random at creation 50/50)
• color: white, brown, black, spotted
• age : 0-10 (years old) [with the exception of mutant bunnies (0-50)]
• Name : randomly chosen at creation from a list of bunny names. radioactive_mutant_vampire_bunny: true/false (decided at time of bunny creation 2% chance of true)

• At program initialization 5 bunnies must be created and given random colors.
• Each turn afterwards the bunnies age 1 year.
• So long as there is at least one male age 2 or older, for each female bunny in the list age 2 or older; a new bunny is created each turn. (i.e. if there was 1 adult male and 3 adult female bunnies, three new bunnies would be born each turn)
• New bunnies born should be the same color as their mother.
• If a bunny becomes older than 10 years old, it dies [with the exception of mutant bunnies, which can become 50 years old].
• If a radioactive mutant vampire bunny is born then each turn it will change exactly one non radioactive bunny into a radioactive vampire bunny. (if there are two radioactive mutant vampire bunnies two bunnies will be changed each turn and so on...)
• Radioactive vampire bunnies are excluded from regular breeding and do not count as adult bunnies.
• Radioactive vampire bunnies do not die until they reach age 50. The program should print a list of all the bunnies in the colony each turn along w/ all the bunnies details, sorted by age.
• The program should also output each turns events such as

Bunny Thumper was born!
Bunny Fufu was born!
Radioactive Mutant Vampire Bunny Darth Maul was born!
Bunny Julius Caesar died!

• The program should write all screen output to a file.
• When all the bunnies have died the program terminates.
• If the bunny population exceeds 1000 a food shortage must occur killing exactly half of the bunnies (randomly chosen)

I've gotten almost all of it done minus the file and GUI part. I'm looking for feedback specifically on performance, decisions with function return values and parameters(ex: returning a list<Bunny> vs taking a list<Bunny> as a parameter and modifying it in the function), design of constructors and other member functions, and use of global variables. Really, anything that would help make me a better programmer would be greatly welcome.

Note: std_lib_facilities.h is simply a standard library access header from a book I use. Oh, and please excuse my lack of creativity with the names.

# Main.cpp

#include "Game.h"
#include <Windows.h>

int main()
{
srand(time(0));
list<Bunny>bunnies;
spawn_bunnies(bunnies);
while (Bunny::count_total_bunnies > 0)
{
Sleep(2000);
end_turn(bunnies);
Sleep(1000);
}
cout << "All bunnies have died!" << endl;
}

# Bunny.h

#include "../../../std_lib_facilities.h"

enum Sex {
male, female
};

enum Color {
white, brown, black, spotted
};

class Bunny {
private:
Sex sex;
Color color;
int age;
string name;
int max_age;
public:
static int count_total_bunnies;
Bunny();
Bunny(Color c);
void increment_age()
{
++age;
}
int get_age() const
{
return age;
}
Sex get_sex() const
{
return sex;
}
Color get_color()
{
return color;
}
string get_name()
{
return name;
}
{
}
{
}
int get_max_age()
{
return max_age;
}
};

# Bunny.cpp

#include "Bunny.h"
vector<string>bunny_names = { "Larry", "Bob", "Tom", "George", "Pal", "Joe", "Nick", "da Bunny"};
int Bunny::count_total_bunnies = 0;
Bunny::Bunny()
:sex{ (rand() % 100 + 1) < 50 ? Sex::male : Sex::female },
color{Color(rand() % 4)},
age{ 0 },
name{ bunny_names[rand() % bunny_names.size()] },
radioactive_mutant_vampire_bunny{ (rand() % 100 + 1) <= 2 ? true : false },
max_age{ radioactive_mutant_vampire_bunny ? 50 : 10 }
{
++count_total_bunnies;
{
cout << "Radioactive Mutant Vampire Bunny " << get_name() << " was born!" << endl;
}
else {
cout << "Bunny " << get_name() << " was born!\n";
}
}
Bunny::Bunny(Color c)
:sex{ (rand() % 100 + 1) < 50 ? Sex::male : Sex::female },
color{ c },
age{ 0 },
name{ bunny_names[rand() % bunny_names.size()] },
radioactive_mutant_vampire_bunny{ (rand() % 100 + 1) <= 2 ? true : false },
max_age{ radioactive_mutant_vampire_bunny ? 50 : 10 }
{
++count_total_bunnies;
{
cout << "Radioactive Mutant Vampire Bunny " << get_name() << " was born!" << endl;
}
else {
cout << "Bunny " << get_name() << " was born!\n";
}

}

# Game.h

#include "Bunny.h"
void spawn_bunnies(list<Bunny>&b); //runs only once in the beginning to instantiate the first 5 bunny objects

void end_turn(list<Bunny>&); // runs every ~2 seconds

bool male_available(const list<Bunny>&); //checks if there is a "valid" male available to reproduce

list<Bunny> females_available(const list<Bunny>&); //returns list of "valid" females to reproduce

void create_babies(list<Bunny>&); //uses list of females_available to determine color of bunny babies, as well as the # of babies

void transform_random_bunny(list<Bunny>&b); //transforms n random normal bunnies into mutant bunnies. n = num of current mutant bunnies

void bunnies_die(list<Bunny>&); //kills half of the bunnies when their count is above 1000

list<Bunny> get_normal_bunnies(const list<Bunny>& b); //returns a list of normal bunnies

# Game.cpp

#include "Game.h"
void spawn_bunnies(list<Bunny>&b)
{
Bunny b1;
Bunny b2;
Bunny b3;
Bunny b4;
Bunny b5;
b = { b1, b2, b3, b4, b5 };
}
void end_turn(list<Bunny>&b)
{
list<Bunny>::iterator bunny = b.begin();
while (bunny != b.end())
{
bunny->increment_age();
if (bunny->get_age() > bunny->get_max_age())
{
cout << "Bunny " << bunny->get_name() << " died!" << endl;
bunny = b.erase(bunny);
--Bunny::count_total_bunnies;
}
else
{
++bunny;
}
}
create_babies(b);
if (Bunny::count_total_bunnies > 1000) bunnies_die(b);
}
bool male_available(const list<Bunny>&b)
{
for (const Bunny b : b)
{
if (b.get_age() >= 2 && b.get_sex() == Sex::male && !b.is_radioactive())
{
return true;
}
}
return false;
}
list<Bunny> females_available(const list<Bunny>&b)
{
list<Bunny>females;
for (const Bunny& bunny : b)
{
if (bunny.get_age() >= 2 && bunny.get_sex() == Sex::female && !bunny.is_radioactive())
{
females.push_back(bunny);
}
}
return females;
}
void create_babies(list<Bunny>& b)
{
list<Bunny>females = females_available(b);
if (male_available(b) && females.size())
{
for (Bunny p : females)
{
Bunny new_bunny{ p.get_color() };
b.push_back(new_bunny);
}
}
}
void transform_random_bunny(list<Bunny>&b)
{
list<Bunny> normal_bunnies = get_normal_bunnies(b);
for (int i = 0; i <= Bunny::count_radioactive_bunnies; i++)
{
list<Bunny>::iterator bunny = normal_bunnies.begin();
normal_bunnies.erase(bunny);
}
}

list<Bunny> get_normal_bunnies(const list<Bunny>& b)
{
list<Bunny>normal_bunnies;
for (const Bunny bunny : b)
{
{
normal_bunnies.push_back(bunny);
}
}
return normal_bunnies;
}
void bunnies_die(list<Bunny>&b)
{
int bunnies_dead = b.size() / 2;
for (int i = 0; i < bunnies_dead; i++)
{
--Bunny::count_total_bunnies;
}
}

• The task description is incosistent: it says 'age:0-10' which looks like a validator condition, but then it turns out some bunnies are allowed to reach the age of 50. – CiaPan Sep 20 '17 at 22:50

## Includes

I figured your std_lib_facilities.h has some includes for vector, list, string and stuff. While you might find that helpful to only have one header , it's rather bad practice. A header should only include the stuff it really needs, no more. Otherwise you might create false dependencies. E.g. your Game.h is the only one that uses list, which it only gets through including bunny that doesn't need it. So if you change the includes in Bunny.h you might break Game.h.

Also every header should have include guards, to prevent double inclusion.

## Avoid using std::endl

Don't use std::endl to print the end of a line to your stream. It flushes the stream unnecessarily and makes your output slower. Simply use \n. For more information see here.

## Don't use using namespace std

Your std_lib_facilities header has a using namespace std somewhere. Don't use that, you are poluting the global namespace with a lot of simple and common names. It's also less readable that way. The name is the namespace is so short on purpose, so that's it not a hassle to write. Again, for more info on that matter read here.

## Don't use magic numbers

You are using hard coded numbers in your code for specific checks (required age for reproduction and max population). While it's easy to see what they are used for it gets harder to change them later on, the more your program grows. Use named variables for them, so it's easier to understand and you can see where they are actually used.

## Don't repeat yourself

Whenever you write the same code twice, you should ask yourself, how you can prevent that in the first place. There are multiple instance where you create random numbers in some interval or check whether an event happened with a certain chance. Make those two things functions that can be reused and more easily read. And while you're at it, replace the random number generator with a better one(you can watch this to see why rand() is considered very bad)). You could write a small namespace for such utility functions, e.g.:

#include <random>

namespace Random
{
static std::random_device rd;
static std::mt19937 mt(rd());

/// Return a random double value between min and max.
inline double real(double min, double max)
{
return std::uniform_real_distribution<double>(min, max)(rd);
}

/// Return a random integer value between min and max.
inline int integer(int min, int max)
{
return std::uniform_int_distribution<int>(min, max)(rd);
}

inline bool flip(double chance)
{
return Random::real(0, 100) <= chance;
}
}

With this you can then replace your calls to rand() with,

advance(dead_bunny, Random::integer(0, b.size() - 1));

:sex{Random::flip(50) ? Sex::male : Sex::female},

Another thins is your constructors for Bunny. They do exactly the same thing, expect for the initialization of color. If you want to change it you always have to do it twice. You could simply redirect the calls as in:

Bunny::Bunny()
: Bunny(Color(Random::integer(0, 3)))
{
}

The same goes for your checking for random events. Make that a function that can take a probability and returns true or false:

bool flip(double chance)
{
return (rand() % 100 + 1) <= chance;
}

It's easier to write and read. The same applies for creating a random number in some interval. And while you're at it, you can also exchange the random number generator for a better one.

## Simplifications

Your spwan_bunnies method is rather strange. If you later decide to start your population with 100 bunnies instead of 5, you would require a lot more variables to fill your list. To initialize your list with a number a default created values, simply write b = std::list<Bunny>(initialPopulation);. This will fill the list with initialPopulation bunnies, which should be some variable in your class.

In your end_turn method you should use a range-based-for loop instead of your while loop. That will make getting the begin iterator beforehand obsolete:

for (auto& bunny : b)
{
bunny.increment_age();
// ...
}

Use auto when it's appropriate. E.g. in std::list<Bunny>::iterator bunny = normal_bunnies.begin(); simply write auto bunny = normal_bunnies.begin(); No need to write something the compiler knows anyway. This way you can also change the container type without changing this part of the code.

## Unecessary copies

In the following code, you're creating and copying too many objects:

    for (Bunny p : females)
{
Bunny new_bunny{p.get_color()};
b.push_back(new_bunny);
}

The use of the range-based-for is great, but you should use a Bunny constreference there, since you only need to read one value of it. Otherwise each female would be copied as the variable p. Furthermore you are creating a new Bunny object and copy that into your list. You should use the emplace_back method in this case, which will directly create the object in the list:

    for (auto const& p : females)
{
b.emplace_back(p.get_color());
}

## Game

Currently your game is just a bunch of methods. It should be a class that keepts track of its population itself, not by passing a list of bunnies. Now I can easily "cheat" the game, by manipulation the bunny list from outside. By keeping track of its own population you could also do things like running multiple games simultaniously, e.g. to compare experiments based on different starting conditions. This would eliminate the static count variables in your bunny class.

## Seperation of concerns

You should seperate your logic from your output. E.g the Bunny shouldn't do any output. It's the games task to do that.

Update:

## Use std::vector as a default

Currently you are using std::list as your container for bunnies. While that sounds reasonable, in C++ you should stick to std::vector unless you have a very good reason not to. Especially since you are randomly selecting bunnies from you list to manipulate them, a std::vector is far better than a std::list, since that can be done immediately, while for a list you have to loop all the way to that element.

## Bug

As mentioned in the comments, the method transform_random_bunny doesn't do what you want. Through the method get_normal_bunnies you are creating a copy of your initial bunnies that a normal. You then only iterate and manipulate this copies list of bunnies, not the original. So your vampire bunnies are not successfull at all. So instead of returning a list of normal bunnies, return the indices of the normal bunnies. And then randomly select ab index out of that list and change that bunny:

void transform_random_bunny(std::vector<Bunny>&b)
{
std::vector<size_t> normal;
for (size_t i = 0; i < b.size(); ++i)
normal.push_back(i);

for (auto i = 0; i < Bunny::count_radioactive_bunnies && !normal.empty(); ++i)
{
auto pos = Random::integer(0, normal.size() - 1);
std::cout << "transformed " << b[normal[pos]].get_name() << "\n";
normal.erase(normal.begin() + pos);
}
}

Note that I already change the container type to std::vector. Otherwise the random access through [] would not work and you'd have to use advance again (or save the iterators instead of indices).

• Hey, thanks for the reply. I feel a bit stupid for writing the spawn_bunnies() method now. In terms of making a game class and iterating using const auto reference, I agree that these would be much better decisions. However, I noticed a mistake I might have made in the transform_random_bunny() function in Game.cpp, so I have one question: wouldn't the current implementation of this function not only remove a bunny from the list of normal bunnies(intended), but also destroy that bunny object(unintended), and as a side effect also remove that bunny object from list<Bunny>&b(list of all bunnies)? – Equilibrium Sep 21 '17 at 13:15
• @Equilibrium: Don't feel stupid - there is no "stupid"! There is either "completely unexperienced" or "partially educated by one's many mistakes" - we're all in one of those two categories. – einpoklum Sep 21 '17 at 22:00
• @Equilibrium No, it won't. Your get_normal_bunnies creates a copy of all Bunnies that are normal and you only erase values from the copied list. However this in turn means, that the function doesn't do what it should do, as the original bunny list ist not modified at all. That's a bug I missed. I will edit a section about that later. – Sebastian Stern Sep 22 '17 at 6:33
• Not-+1'ing you because you've suggested code using rand() (and which, in particular, does not meet the problem definition because of the failures of rand(). – einpoklum Sep 22 '17 at 13:05
• @Equilibrium Rather late, but I added a small section about the transform_random_bunny method if that's still helpful. – Sebastian Stern Sep 27 '17 at 15:54

## Don't try to optimize without reason

I'm looking for feedback specifically on performance

Don't. You're writing code which:

• Involves a small amount of data - no more than 1,000 bunnies, each of them of them limited to, what, less than 32 bytes and that's if you make copies of the names rather using name indices.
• Involves a small number of iterations - in expectation anyway. Once you have a radioactive vampire bunny born your colony will be dead in, let's say, well under a 100 turns in expectation (back-of-the-envelope estimate); and assuming you don't run out of females (in which case the colony will die within 49 years), you have an extremely low chance of not getting a radioactive mutant within, say, 10 * 1/2% = 500 turns. So overall, very low probability of over 1,000 turns if I figure things right.
• You're using a linked list, so your performance is going to be rather weak anyway.

It makes no sense to optimize inherently-slow code which won't benefit from optimization anyway. Focus (in general, not just in this example) on writing clean, readable code, using standard libraries where relevant, sticking to the C+= core guidelines (those you agree with anyway) - and that's quite enough.

Only when you know with relative certainty that your code is now, or is going to be, slower than you need it to - then start investing in performance enhancement.

## Don't use rand() - use the C++11 <random> facilities

Watch this: rand() considered harmful!. Convinced? Good. Instead of using rand(), use C++11's <random> facilities. Here's how:

https://stackoverflow.com/questions/32927722/how-to-use-random-to-replace-rand

Note you'll want an std::bernoulli_distribution for flipping coins.

## Use meaningful names

Remember, code is written once (hopefully) and read many times. So it's not a reasonable idea to shorten names to spare yourself typing. Thus, instead of:

void set_radioactive(bool b);

use

void set_radioactive(bool is_radioactive);

(although you migh

Example: The Bunny method

public:

void make_radioactive();

should suffice. Now, this too is not perfect, as it does not reflect the fact that only other radioactive bunnies can make bunnies radioactive (after construction), but let's not go there.

## Use const members

Instead of having protected members with public getters, just make them public const members.

## Don't keep game information inside the bunny class

The total and radioactive bunny counts are meaningful in the context of a game; keep them there - either as globals, as locals of main(), or as member variables of a Game class instance.

## Don't "memoize" essentially-static data without good reason

Your Bunny class has a max_age member. Why? Can you have a different maximum age for every bunny? No, that depends solely on whether or not you're radioactive. So really,

int max_age() const { return is_radioactive() ? 50 : 10; }

it would only make sense to "memoize" the result of this function, and keep a max_age member, if computing it was relatively expensive and it was used frequently. The former certainly doesn't hold in our case.


text:
# Clipped From The Daily Review

Loop and In l o \ v Â» i i ( I n Tcxab i l Â« to i i.mdst n s , p, s,ii , , n ' i - d i n \ ,, l j n i l l i n tin m si, ins i , is, i P i sld, 11 t l v D I p r a n d i h i T | u s t to b in o n i i n . m l t t i s l ' i | t ll O I . H . I I m l i n M H I thr. vv i v i i i i o i i l i n i b u n , b i mn t n I , h - , is t . s u m i t i i l v -- t M t vx is ' h i t w m u ,1 t In s h o r t s i i b s t t n i i l i is M n i n i i n on i l u d i t ^ in I i nn t i u l in n . t n i t t e i \ \ i t h U s ttiss Map DÂ»n\$morÂ« now the Longest Malrttf Lady In to* Worid DANDERINE Contains most remarkably invigorating qualities. Knowlton Danderine Co., Chicago, III. March 2, 1901. Gentlemen:--I commenced using your Danderine two years ago for falling hair, dandruff and an impoverished condition the scalp, and I found it so pleasant to use that I have ever'since. It surely contains most invigorating qualities, hair stopped falling out, and has grown overan inch in length every month since I commenced using it. My hair at the time is over eight feet long, silky, glossy and perfectly healthy. I most surely do lecommend Danderine. Yours truly i m I E. BURNHAM INDORSES DANDERINE ThÂ» only PerUct Hair and Soalp Tonic. Mr jiiiniliaw, 72 t.ite st, Central 11 i l l , (oiulttcts the, nkiebt, imest K i u i w u Hair dre'MnR tst.tbli^hment i ( \ of lueapei lie lus had twenty \.ir" e x p e i i f i u H in tliihMjic; the hail and h i a l j ) and lia^ lestett I n n pie\),iialii)iis iliirilij; tlirft tniu. He t l e i t f o i e is. in jiosiiniii to leiogrni/o ulien it i \ist-, in i liÂ«n leiiiii Thf people (it ( l i u . i g o k i i u t t Hi Jimuhdiu i i n i p i e i i i t i tin \ a l u t ot Ke id \ \ l u t lie srfjs Feb. 23, 1901. The Knowlton Danderine Co., Chicago, III. Gentlemen: It is with no little gratification that I give Danderine my hearty indorsement and sup_ sup_ .. . , port. I was induced to put it in posed b, re,,uÂ» 6 . oi Kno, ,-c, Dandenn - Co stock t h r o u g h t h e splendid indorse- ment given you by Jessie Bartlett Davis. It has proven its merits to such an extent that I have found it almost indispensable among my customers; its results results are positive and permanent. permanent. R e s p e c t f u l l y , p- d i ts i \ e h t l r softness growth and lustPr of the y o u t h i t ^ f l t cannot ( f i l i a l N e - r i w i a n t e e tint muie KI n i t IK lesul 1 th.in g i l l o is ot tin. ' anous mixtures tailed and I m i r t d i i h w i t h \ \ l n i h tne i'iark( t i ll.mded Dunderine and it't i n n ueii l i d bv ion e u Hit hesl k n o w n penjik ni t ''lit is t a n i l ' s I n_;i i t l in ill d t l cr l i a i r t o i i u s mil \ e H \ Anv diuj,a;ist in l ic U i l i r e c u t i n t i \ \ \ i not 1 jtind i \ i tl\ as l e p i t ^ i ui d ' ^_ v it icls in ill cJlbordf-rsol t i n - t u n and snip mch jvlnilrfjllhii: i wi \ \ l U s ml i l u f c i s d iii| k f r i Â» hv n t i i r n in Ml to i l \ uNi i ieut w tn th li n j i i i t mil ,.lilicÂ« and to m u i n g j i s t i t t i ^ s i x , Â« 25c., 6Oo. and FREE I ) t ho\ t o^ itn, i it. d ,. oi s t n n i H lo | i i t uo KNOWLTON OANOERINE CO., CHICAGO.


text:
# performance tuning – How to quickly calculate the large inverse matrix

I want get the Jacobian inverse matrix (100 * 100) as fast as possible for Newton's method.

but my implementation is slow, is there a good way?

in this question, I mean,

$$function = first + second.vector + third.vector.vector.$$
first is ($$100 times 1)$$ vector
second is( $$100 times 100)$$ matrix.
third is ($$100 times100 times100)$$ tensor.

prepare the material (not main for the question, but need to prepare vector / matrix / tensor).

``````expr = -0.5 * x ^ 2 + 0.5 * derivative[0, 1][v][t, x]^ 2 + derivative[1, 0][v][t, x];
discriminate = {derivative[1, 0][v][t, x]    -> (v[i + 1, j] - v[i - 1, j]) / (2 * dt), derivative[0, 1][v][t, x]    -> (v[i, j + 1] - 2 * v[i, j] + v[i, j - 1]) / dx ^ 2, x -> x[j]};
param = {dt -> 0,1, dx -> 0,1};
xmax = 1;
xmin = 0;
dx = 0.1;
nx = IntegerPart[(xmax - xmin)/dx];
Make[x[i] = xmin + i * dx, {i, 0, nx}];
discritinize2 = {derivative[1, 0][v][t, x]    -> (v[i + 1, j] - v[i, j]) / dt, derivative[0, 1][v][t, x]    -> (v[i, j + 1] - 2 * v[i, j] + v[i, j - 1]) / dx ^ 2, x -> x[j]};
before = expr /. to discriminate2 /. param;
middle = expr /. to discriminate. param;
Make[v[i, -1] = 0, {i, 0, nx}];
Make[v[nx, i] = x[i] - X[i]^ 2, {i, 0, nx}];
{first, second, third} = CoefficientArrays[Flatten[Table[If[i == 0, forward, middle], {i, 0, nx - 1}, {j, 0, nx - 1}]], Flatten[Table[v[Table[v[Table[v[Table[v[i, j], {i, 0, nx - 1}, {j, 0, nx - 1}]]]vector = Flatten @ Table[v[v[v[v[i, j], {i, 0, nx - 1}, {j, 0, nx - 1}];
``````

First, I tried the symbolic calculation.

``````AbsoluteTiming @
SparseArray[
first + Dot[second, vector] + Point[third, vector, vector]]vector]
``````

=>

``````\$ Aborted (* more minutes past *)
``````

Second,
Specific value of substitution,
and solve for $$r$$ in $$J_F (x_n) (r) = – F (x_n)$$ to avoid calculating the inverted Jacobian.
(I've found this method here)

$$J_F (x_n)$$ is the matrix,
$$r$$ is vector,
$$-F (x_n)$$ is the vector of the value of the function.

``````testVector = Flatten @ Table[0.2, {i, 0, nx - 1}, {j, 0, nx - 1}];
Jacobian =
SparseArray[
SparseArray[
first + Dot[second, vector] + Point[third, vector, vector]],
vector]/. wire[Rule[vector, testVector]]];
funcion =
SparseArray[
Normal[first + Dot[second, vector] +
Point[third, vector, vector]]/.
wire[Rule[vector, testVector]]];
AbsoluteTiming @ SparseArray @ LinearSolve[jacobian, f]
``````

=>

``````9.237s
``````

At this speed, it is a bit difficult for iteration.


text:
# Work out if a string is "fieldname" or "tablename.fieldname", and assign variables

Is there a neater way to write this code?

    var table, field, dbFieldEntries;
var s = 'one.two';
// The DB field is always the first parameter
dbFieldEntries = s.split( '.' );
if( dbFieldEntries.length === 1 ){
field = dbEntryEntries[ 0 ];
} else {
table = dbEntryEntries[ 0 ];
field = dbEntryEntries[ 1 ];
}

Basically, s can be either something or something.other. If it's something, then table is undefined and field is something; it it's something.other, then table is something and field is other.

• It is a bit hard to review code like this because the code you are showing is just a short version of the code that you're actually using in a real project, which means that a lot of context has been stripped away. Unlike Stack Overflow, we prefer to look at real code instead of example code. Adding a description about what this code is supposed to do will greatly help, as would adding more code-context. Feb 2 '15 at 0:41
• Did you downvote my question?!? 1) There was no point in showing anything more, since the code is fully self contained. I cut dump the whole of SimpleDbLayer if you like, it's not going to change the self contained chunk I want to improve 2) What the code does is written RIGHT BELOW the code. I thought that was really quite clear. The answer I see below, that I am about to accept, is indeed a fantastic response. Please get rid of the downvote since your observations were meaningless.
– Merc
Feb 2 '15 at 4:45
• For the record, I was not the one who downvoted your question. I can understand the one who did though because it is not entirely clear where the s value comes from, and if you would have revealed more about that then we could have suggested an entirely different approach which might have improved your code even more. Feb 2 '15 at 11:25

Assuming that field always gets the value of the last part of dbFieldEntries you could do:

field = dbEntryEntries[ dbFieldEntries.length - 1 ];
if ( dbFieldEntries.length > 1 ) {
table = dbEntryEntries[ 0 ];
}

Besides this, s is a bad variable name.

• Ah, this is exactly the kind of thing I was after. Thank you! This is so much better than the ugly stuff I had...
– Merc
Feb 2 '15 at 4:46
field = dbFieldEntries.pop();
table = dbFieldEntries.length ? dbFieldEntries[0] : undefined;

... of course, that's working on the assumption that it's only possible to have one or two things seperated by a single ".", which your code definitely does assume.


text:
# Tag Info

If you are happy with an approximation, then you can use approximate Laplacian solving, which takes time $\widetilde{O}(m)$. This is done explicitly in this paper by Spielman and Srivastava, Theorem 2. My guess is that this is optimal, even if you just want to determine the edge with maximal effective resistance.


text:
### Interesting Trigonometry Question

We know how A’levels like to combine a few topics across. We also know how bad trigonometry can be. I was coaching my International Bachelorette (IB) class last week and came across a fairly interesting question. It tests students on their abilities to manage double angle identities. Not a tough question, but definitely good practice 🙂
FYI: All double angle identities are found in MF26.
Here it is…

(a) Show that $(1 + i \text{tan} \theta)^n + (1 - i \text{tan} \theta)^n = \frac{2 \text{cos} n \theta}{ \text{cos}^n \theta}$, $\text{cos} \theta \neq 0$.

(b)
(i) Use the double angle identity $\text{tan} 2 \theta = \frac{2 \text{tan} \theta}{1 - \text{tan}^2 \theta}$ to show that $\text{tan} \frac{\pi}{8} = \sqrt{2} - 1$.

(ii) Show that $\text{cos} 4x = 8 \text{cos}^4 x - 8 \text{cos}^2 x + 1$.

(iii) Hence find the value of $\int^{\frac{\pi}{8}}_0 {\frac{2 \text{cos} 4x}{ \text{cos}^2 x}}~dx$ exactly.

### Random Questions from 2017 Prelims #1

Last year, I shared a handful of random interesting questions from the 2016 Prelims. Students feedback that they were quite helpful and gave them good exposure. I thought I share some that I’ve seen this year. I know, its a bit early for Prelims. But ACJC just had their paper 1. 🙂

This is from ACJC 2017 Prelims Paper 1 Question 7. And it is on complex numbers.

7
(a) Given that $2z + 1 = |w|$ and $2w-z = 4+8i$, solve for $w$ and $z$.

(b) Find the exact values of $x$ and $y$, where $x, y \in \mathbb{R}$ such that $2e^{-(\frac{3+x+iy}{i})} = 1 -i$

I’ll put the solutions up if I’m free.

But for students stuck, consider checking this link here for (a) and this link here for (b). These links hopefully enlightens students.

Just FYI, you cannot $\text{ln}$ complex numbers as they are not real…

### Thinking [email protected] #8

[email protected] is a series of questions that we, as tutors feel that are useful in helping students think and improve their understanding.

Thinking [email protected] is curated by KS. More of him can be found here

This is a interesting Complex Number Question.

The complex number $z$ satisfies $z + |z| = 2 + 8i$. What is $|z|^2$

### A little history of e

Some students remarked on why I actually recognise e, that is, $e=2.718281828...$. Well, e is a rather unique constants. Firstly, for all JC students, we see it our daily algebra & complex numbers. Students exposed to university statistics will see e appearing in the formula for normal distribution, that is, $f(x | \mu , \sigma^2) = \frac{1}{\sqrt{2 \sigma^2 \pi}} e^{-\frac{(x-\mu)^2}{2 \sigma^2}}$.

Secondly, the story of how it came about is pretty cool as you will observed in the video below.

The Story of e

Hopefully it provides you with another perspective towards this constants! And now you should be more cautious when signing up savings plans that give interest per annum or per month.

### Thoughts about 2016 A’levels H2 Mathematics Paper

I’ve covered some things in classes, with sufficient revisions and final lap papers set. So I thought we have a little breakdown. And of course, we should review what was weeded away in the 9740 H2 Mathematics Syllabus. After all, this is the very LAST time the can test them.

1. Recurrence Relations. I’ve harped on this last year too. Conjectures! Conjectures! You can read more about it here. An a question involving conjecture should start with a recurrence relation, then a conjecture, ending with a recurrence MI. Students should know how to do both $\Sigma$ and recurrence MI. Yes, they are different.

2. Loci. You guys are the lucky last batch to do Loci. So please buy a protractor and compass. Draw them, as one of my student put it, surgically. If need be, use a graph paper (why not?). Harder loci for example can require students to draw for example, $\text{arg}(z-1+2i) = \text{tan}^{-1}(\frac{4}{3})$. You should not have trouble measuring this angle, because you could not even be able to do it. Students should be able to draw such angles with ease. One little note about Loci, will definitely their geometrical descriptions. Many students can draw this, but stumble to describe them.

3. Vectors. Truth be told, I’m still waiting for a question involving vectors in 3D, to land in A’levels. An example can be the HCI Prelims Paper 1 Question 6, which can be found here.

4. Poisson Distribution. I don’t know what this topic has been axed. So students should ready for one big Poisson Distribution questions, I say give it 12-14 marks. And it should be tested with conditional probability. I’ll practice either Demand & Supply or Inflow & Outflow questions. An example can be the one found in NYJC Prelims Paper 2 Question 11, which can be found here.

5. Correlation & Regression. Ever wondered what the $r^2$ means in the GC? Well, $r^2 = bd$ is being removed from the syllabus as well. It hasn’t surfaced before, so maybe it shall finally make its one and only LAST presence felt this year. Students should familiarise themselves with the use of $y- \bar{y} = b ( x - \bar{x})$ equation, which can be found in the MF15. I know many of you probably have not seen it before.

6. Hypothesis Testing. Students should review definitions of level of significance and p-value. Also understand what you may conclude from a Z-Test, using the results of a T-test. A little small part that students can think about, is why use a small sample size? After all, we know that have a sufficiently large $n$ allows us to perform CLT and then use a Z-Test.

7. Trigonometry. After it appeared in 2011 for a trigonometry MI, the product to sum formulas is still a problem for most students. I highly doubt its coming out again with MI, but its can easily come out again with complex numbers. An example can be this.

More examples and discussion will be made in class.

### Trigonometry used in complex Numbers

Given $z = \text{cos}\alpha + i \text{sin} \alpha$ and $w = \text{cos}\beta + i \text{sin} \beta$

$z - w = \text{cos}\alpha + i \text{sin} \alpha -(\text{cos}\beta + i \text{sin} \beta)$

$z - w = \text{cos}\alpha -\text{cos}\beta + + i \text{sin} \alpha - i \text{sin} \beta)$

$z - w = - 2 \text{sin}(\frac{\alpha-\beta}{2})\text{sin}(\frac{\alpha+\beta}{2}) + i 2 \text{sin}(\frac{\alpha-\beta}{2})\text{cos}(\frac{\alpha+\beta}{2})$

$z - w = 2 i \text{sin}(\frac{\alpha-\beta}{2}) (\text{cos}(\frac{\alpha+\beta}{2}) + i \text{sin}(\frac{\alpha+\beta}{2}))$

$z - w = 2 i \text{sin}(\frac{\alpha-\beta}{2}) e^{\frac{\alpha + \beta}{2}}$

### Random Questions from 2016 Prelims #11

TPJC/P2/4

(a) The complex number w is given by $3+3\sqrt{3}i$
(i) Find the modulus and argument of w, giving your answer in exact form.
(ii) Without using a calculator, find the smallest positive integer value of n for which $(\frac{w^3}{w^*})^n$ is a real number.

(b) The complex number z is such that $z^5 = - 4 \sqrt{2}$
(i) Find the value of z in the form $re^{i\theta}$, where $r > 0$ and $- \pi \textless \theta \le \pi$.
(ii) Show the roots on an argand diagram.
(iii) The roots represented by $z_1$ and $z_2$ are such that $0 \textless arg({z_1}) \textless arg({z_2}) \textless \pi$. The locus of all points z such that $|z - z_1| = |z-z_2|$ intersects the line segment joining points representing $z_1$ and $z_2$ at the point P. P represents the complex number p. Find, in exact form, the modulus and argument of p.

### Random Questions from 2016 Prelims #10

PJC P2 Q1

The complex numbers a and b are given by $2 + 3i$ and $-4-5i$ respectively.

(i) On a single Argand diagram, sketch the loci
(a) $|2z-a-b| = |a-b|$
(b) $0 \le \text{arg}(z-b) \le \text{arg}(a - b)$

(ii) Find the range of $\text{arg}(z)$ where $z$ is the complex number that satisfies the relationships in part (i)

### Random Questions from 2016 Prelims #6

HCI P1 Q5

Sketch on a single Argand diagram, the loci defined by $-\frac{\pi}{4} \textless \text{arg}(z+1+2i) \le \frac{\pi}{4}$ and $|(2+i)w+5| \le \sqrt{5}$

(i) Find the minimum value of $\text{arg}(w)$

(ii) Find the minimum value of $|z-w|$

(iii) Given that $\text{arg}(z-w) \textless \theta, - \pi \textless \theta \le \pi$, state the minimum value of $\theta$

### Golden Nugget!!!

$1 + 2 + 3 + 4 + 5 + ... = -\frac{1}{12}$

My brother shared this interesting video with me a few days back when he was at the screening for The Man Who Knew Infinity. I’m looking forward to watching this movie too!

Back to the video! It focuses on the sum that is written above. And interestingly, this sum that should not be defined (as what JC students learnt in Arithmetic Progression), is actually a NEGATIVE number. Explain excellently by professor Edward Frenkel. He brings in interesting concepts from complex numbers too. Hopefully, this piques some interest!

Professor Edward Frenkel wrote a book “Love & Math”, which is really intriguing. You don’t have to love math to read it but you will after reading 🙂

You can read more here too.