<p>Your maths looks ok, bar the fact that <span class="math-container">$1/$</span>parallax is a biased estimate of the distance (but that can be forgiven so long as you are using data where the parallax uncertainties are much smaller than the parallax).</p>

<p>Your main problem is that stars do indeed have a vast range of sizes. Thus if you really do want to show the relative sizes of the stars you have a dynamic range problem.</p>

<p>The conventional way to deal with this would be to use a logarithmic scale, such that each increment in size corresponds to a <em>multiple</em> of the one below. e.g. Make your plotted radii proportional to <span class="math-container">$\log_{10} R_{\rm rel}$</span>.</p>

<p>EDIT: In response to altered emphasis of question.</p>

<p>It seems you no longer want to scale the stars according to their actual radius, but rather according to their brightness. The logarithmic scaling is therefore already handled by the apparent magnitude (which is on a logarithmic scale).</p>

<p>Therefore all you need to do is decide what your smallest and largst radius are and compare that with the brightest and faintest magnitudes you want to plot.</p>

<p>e.g. If your biggest star is 5 units and your smallest is 0 units, and your bright and faint limits are <span class="math-container">$m_{\rm bright}$</span> and <span class="math-container">$m_{\rm faint}$</span> respectively, then the size of an arbitrary star of magnitude <span class="math-container">$m$</span> is
<span class="math-container">$$ r =\frac{5(m -m_{\rm faint})}{m_{\rm bright} -  m_{\rm faint}} \ .$$</span></p>

<p>And if you want your faintest stars to be size 1 and brightest to be 5, this modifies to
<span class="math-container">$$ r =\frac{4(m -m_{\rm faint})}{m_{\rm bright} -  m_{\rm faint}} +1 \ .$$</span></p>

<p>Yet another alternative would be to make the <em>area</em> proportional to magnitude. Again, scaling between radii of 5 and 1:</p>

<p><span class="math-container">$$ r^2 =\frac{24(m -m_{\rm faint})}{m_{\rm bright} -  m_{\rm faint}} +1 \ .$$</span></p>

CC BY-SA 4.0
2020-06-01T18:20:19.290Z
Minimum size should be nonzero, and a linear function of *m* is too steep at the dim end.
Mike G
CC BY-SA 4.0
2020-06-01T18:37:38.067Z
@MikeG Your solution just scales as square root of flux and goes down by a factor of 1.6 for every magnitude! Minimum size can be set to whatever you like by adding a constant. Mine scales linearly with magnitude which is how the eye works.
ProfRob
CC BY-SA 4.0
2020-06-03T14:55:08.097Z
With the second formula, r(0) / r(1) = 1.15, and r(5) / r(6) = 1.54.
Mike G
CC BY-SA 4.0
2020-06-01T07:18:02.640Z
2020-06-01T19:25:01.773Z
2020-06-01T19:25:01.773Z
ProfRob
<p>The SDSS exercise shows how to estimate a star's actual radius.
If you use this radius, you should also use different model materials for different color index values, since luminosity per unit area is a function of temperature.
If you prefer to avoid that complexity, base your model stars' radii on visual magnitude alone.
If you put the model stars at a uniform distance from the observer, use apparent magnitude instead of absolute magnitude.</p>

<p>Suppose your celestial sphere radius is 1000 units, and you want <a href="https://en.wikipedia.org/wiki/Sirius" rel="nofollow noreferrer">Sirius</a> (apparent magnitude <em>m</em><sub>min</sub>&nbsp;=&nbsp;-1.45) to have an apparent angular radius of 5 milliradians.
Then the Sirius model radius <em>r</em><sub>max</sub> would be 5 units, and a star of apparent magnitude <em>m</em> would have model radius
<span class="math-container">$$\begin{align}
r(m) &amp;= r_\mathrm{max} \times 10^{(m_\mathrm{min} - m)/5} \\
     &amp;= 5 \times 10^{-1.45 / 5} \times 10^{-m/5} \\
     &amp;= 2.6~e^{-0.46~m}
\end{align}$$</span></p>

<p>If you also wish to set a minimum star model radius,
try <em>r(m) = be<sup>am</sup></em> where
<span class="math-container">$$\begin{align}
a &amp;= \frac{\ln r_{\mathrm{min}} - \ln r_{\mathrm{max}}}{m_{\mathrm{max}} - m_{\mathrm{min}}} \\
\\
b &amp;= r_{\mathrm{max}}~e^{-a~m_{\mathrm{min}}} = r(0)\\
\end{align}$$</span></p>

<p>For example, to get <em>r</em>(6.0)&nbsp;=&nbsp;0.5 with <em>r</em>(-1.45)&nbsp;=&nbsp;5 as above, you could use
<span class="math-container">$$ r(m) = 3.2~e^{-0.31~m} $$</span></p>

<p>These model radii are nowhere near reality but should produce a recognizable night sky.
In real life the <a href="https://en.wikipedia.org/wiki/Solar_radius" rel="nofollow noreferrer">Sun's radius</a> is about 2.3&times;10<sup>-8</sup> pc.</p>

CC BY-SA 4.0
2020-05-31T23:06:34.597Z
what does the m subscript min stand for?
SidS
CC BY-SA 4.0
2020-05-31T23:32:53.883Z
@SidS The apparent magnitude of the brightest star.
Mike G
CC BY-SA 4.0
2020-06-01T13:23:03.317Z
I've implemented a slightly modified version of this equation - the result looks amazing, however, astronomy.net is still not able to detect the stars and constellations. Please refer to the edit that I've made to the question for more details. Thanks!
SidS
CC BY-SA 4.0
2020-06-01T20:22:36.890Z
The Hipparcos catalogue has stars between apparent magnitudes -1.4 and 8. Your radii would be from 5 to 0.06 (or 0.16 at 6th mag). Contrary to the comment you attached to my answer, *your* prescription is too steep at faint magnitudes (and squared if you think the area is what represents apparent brightness), mine is much shallower. That is why it is hard to recognise constellations that are typically defined by stars having a 3-4 mag range. In your scheme this is a range of 16-43 in spot area.
ProfRob
CC BY-SA 4.0
2020-06-01T23:04:47.913Z
@RobJeffries Added a minimum radius parameter while preserving r(0)/r(1) = r(5)/r(6).
Mike G
CC BY-SA 4.0
2020-05-31T22:28:55.973Z
2020-06-01T23:06:08.683Z
2020-06-01T23:06:08.683Z
Mike G
<p>Using the Hipparcos catalogue, I am trying to create a celestial sphere. As all the stars are a fixed distance from the centre of this sphere, the only way to differentiate the distances and magnitude is through the sizing of each model of the star.</p>

<p>With the Parallax angle <span class="math-container">$p$</span> and visual magnitude <span class="math-container">$m_{vis}$</span> of each star from the catalogue, I have created the code below to calculate the radius of each star relative to the radius of the sun. I had used <a href="http://cas.sdss.org/dr7/en/proj/advanced/hr/radius1.asp" rel="nofollow noreferrer">this website</a> to calculate this. The problem is that some stars are too big, almost bigger than the celestial sphere itself! I am trying to keep the radius below a certain threshold.</p>

<p>Here <span class="math-container">$p$</span> is in arcseconds and <span class="math-container">$d$</span> is in parsecs.</p>

<p><span class="math-container">$$d = 1 / p$$</span></p>

<p><span class="math-container">$$M_{abs} = M_{vis} - \log_{10}(d^5) + 5$$</span></p>

<p><span class="math-container">$$ T_{surf} = \frac{8540}{CI + 0.865}$$</span></p>

<p><span class="math-container">$$R_{rel} = \left( \frac{5800}{T_{surf}} \right)^2 \sqrt{(2.512)^{4.83 - M_{abs}}}$$</span></p>

<p><span class="math-container">$$R_{Sun} = 2.5$$</span></p>

<p><span class="math-container">$$r = R_{rel} R_{Sun}$$</span></p>

<pre><code>    private void positionStar()
    {
        double radius;
        cartesianPositioningCalc();
        gameObject.transform.position = cartesianPositioning;

        // Convert Plx from milliarcseconds to arcseconds (seconds of arc)
        double PlxSOA = Plx / 1000;
        // Calculate distance from equation d=1/p
        // distance d is measured in parsecs and the parallax angle p is measured in arcseconds.
        double dPC = 1 / PlxSOA;

        double absMag = Vmag - math.log10(math.pow(dPC, 5)) + 5;

        surfaceTemperature = 8540 / (CI + 0.865);

        double relativeRadius = math.pow((5800 / surfaceTemperature), 2) * math.sqrt((math.pow(2.512, (4.83 - absMag))));
        double radiusSun = 2.5f;

        radius = relativeRadius * radiusSun;

        gameObject.transform.localScale = new Vector3((float)radius, (float)radius, (float)radius);
    }
</code></pre>

<p>First of all, am I using the right mathematics? If I am, then how can I make sure that the radius is below a certain maximum threshold (5 units, for example.)?</p>

<p>If the mathematics is incorrect, please assist me on how to fix it.</p>

<p>Thanks!</p>

<hr>

<p>With a slightly modified version of @Mike G's formula in their answer below:</p>

<p><img src="https://latex.codecogs.com/gif.latex?%5CLARGE%20r%28m%29%20%3D%2050%20*%2010%5E%7B%28-1.44%20-%20m%29%20/%205%7D" alt="r(m) = 50 * 10^{(-1.44 - m) / 5}"></p>

<pre><code>radius = 50 * math.pow(10, (-1.44 - Vmag) / 5);
</code></pre>

<p>I was able to get this result:
<a href="https://i.sstatic.net/O5d1I.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/O5d1I.png" alt="Star Field"></a></p>

<p>And if I'm not mistaken, I think I can locate the Ursa Major constellation offset slightly to the left from the centre of the screenshot.</p>

<p>However, after uploading to <a href="https://nova.astrometry.net" rel="nofollow noreferrer">nova.astrometry.net</a> the stars and constellations are still not being picked up. Is this because the star sizing is still a bit incorrect or is this issue on the website's side?</p>

<p>I can use another website/app such as Stellarium to cross-check, is there a way the app can process an input image or do I try to recreate using my image on the app?</p>

CC BY-SA 4.0
2020-05-31T22:24:00.470Z
I've done my best to convert your computer code to readable equations using [MathJax](https://math.meta.stackexchange.com/q/5020/284619). Please double check it.
uhoh
CC BY-SA 4.0
2020-06-01T13:44:38.627Z
This is totally confused. Your question asks about plotting stars according to their radius, but now you seem to want to plot them with a size correponding to their brightness. The two are only indirectly related and brightness does not involve the parallax at all.
ProfRob
CC BY-SA 4.0
2020-06-01T13:49:48.530Z
In @Mike G's answer, they talk about how it is much simpler to base the stars' radius with the apparent magnitude instead - this is why I have taken this route. However, if there's a simpler route to incorporate their actual radius and also make all the stars uniformly sized, then I will explore it further. I will change the title of the question to make more sense
SidS
CC BY-SA 4.0
2020-06-01T16:56:58.070Z
Looking better! I recognize a few other constellations too, but they're mirror-reversed. Also math.pow(math.E, x) == math.exp(x). Consider adding more light sources, increasing the ambient term, or using an emissive material.
Mike G
CC BY-SA 4.0
2020-06-03T12:30:36.663Z
@MikeG - Regarding how the stars are mirror-reversed, I used this website, http://fmwriters.com/Visionback/Issue14/wbputtingstars.htm, to convert the RA and DE to x,y,z. How do I fix this to plot the stars correctly?
SidS
CC BY-SA 4.0
2020-06-03T14:44:14.980Z
The Cartesian coordinate conversion there is correct for right-handed x,y,z. If your axes are right-handed, and your camera is at the center of the celestial sphere, I don't know what's wrong, but inverting any one axis would work around it.
Mike G
<star><apparent-magnitude><size><parallax><absolute-magnitude>
Best way to simulate star sizes to scale in celestial sphere
SidS
# Best way to simulate star sizes to scale in celestial sphere

(Asked by: username_0 on 2020-05-31)

Using the Hipparcos catalogue, I am trying to create a celestial sphere. As all the stars are a fixed distance from the centre of this sphere, the only way to differentiate the distances and magnitude is through the sizing of each model of the star.
With the Parallax angle $p$ and visual magnitude $m_{vis}$ of each star from the catalogue, I have created the code below to calculate the radius of each star relative to the radius of the sun. I had used this website to calculate this. The problem is that some stars are too big, almost bigger than the celestial sphere itself! I am trying to keep the radius below a certain threshold.
Here $p$ is in arcseconds and $d$ is in parsecs.
$$d = 1 / p$$
$$M_{abs} = M_{vis} - \log_{10}(d^5) + 5$$
$$ T_{surf} = \frac{8540}{CI + 0.865}$$
$$R_{rel} = \left( \frac{5800}{T_{surf}} \right)^2 \sqrt{(2.512)^{4.83 - M_{abs}}}$$
$$R_{Sun} = 2.5$$
$$r = R_{rel} R_{Sun}$$
    private void positionStar()
    {
        double radius;
        cartesianPositioningCalc();
        gameObject.transform.position = cartesianPositioning;

        // Convert Plx from milliarcseconds to arcseconds (seconds of arc)
        double PlxSOA = Plx / 1000;
        // Calculate distance from equation d=1/p
        // distance d is measured in parsecs and the parallax angle p is measured in arcseconds.
        double dPC = 1 / PlxSOA;

        double absMag = Vmag - math.log10(math.pow(dPC, 5)) + 5;

        surfaceTemperature = 8540 / (CI + 0.865);

        double relativeRadius = math.pow((5800 / surfaceTemperature), 2) * math.sqrt((math.pow(2.512, (4.83 - absMag))));
        double radiusSun = 2.5f;

        radius = relativeRadius * radiusSun;

        gameObject.transform.localScale = new Vector3((float)radius, (float)radius, (float)radius);
    }

First of all, am I using the right mathematics? If I am, then how can I make sure that the radius is below a certain maximum threshold (5 units, for example.)?
If the mathematics is incorrect, please assist me on how to fix it.
Thanks!

With a slightly modified version of @Mike G's formula in their answer below:

radius = 50 * math.pow(10, (-1.44 - Vmag) / 5);

I was able to get this result:

And if I'm not mistaken, I think I can locate the Ursa Major constellation offset slightly to the left from the centre of the screenshot.
However, after uploading to nova.astrometry.net the stars and constellations are still not being picked up. Is this because the star sizing is still a bit incorrect or is this issue on the website's side?
I can use another website/app such as Stellarium to cross-check, is there a way the app can process an input image or do I try to recreate using my image on the app?

**Tags:** star, apparent-magnitude, size, parallax, absolute-magnitude
> **Comments:**
> **username_1**: I've done my best to convert your computer code to readable equations using [MathJax](https://math.meta.stackexchange.com/q/5020/284619). Please double check it.  
> **username_2**: This is totally confused. Your question asks about plotting stars according to their radius, but now you seem to want to plot them with a size correponding to their brightness. The two are only indirectly related and brightness does not involve the parallax at all.  
> **username_0**: In @Mike G's answer, they talk about how it is much simpler to base the stars' radius with the apparent magnitude instead - this is why I have taken this route. However, if there's a simpler route to incorporate their actual radius and also make all the stars uniformly sized, then I will explore it further. I will change the title of the question to make more sense  
> **username_3**: Looking better! I recognize a few other constellations too, but they're mirror-reversed. Also math.pow(math.E, x) == math.exp(x). Consider adding more light sources, increasing the ambient term, or using an emissive material.  
> **username_0**: @MikeG - Regarding how the stars are mirror-reversed, I used this website, http://fmwriters.com/Visionback/Issue14/wbputtingstars.htm, to convert the RA and DE to x,y,z. How do I fix this to plot the stars correctly?  
> **username_3**: The Cartesian coordinate conversion there is correct for right-handed x,y,z. If your axes are right-handed, and your camera is at the center of the celestial sphere, I don't know what's wrong, but inverting any one axis would work around it.  

---

## 2 answers

### Answer by username_2 on 2020-06-01. Score: 3

Your maths looks ok, bar the fact that $1/$parallax is a biased estimate of the distance (but that can be forgiven so long as you are using data where the parallax uncertainties are much smaller than the parallax).

Your main problem is that stars do indeed have a vast range of sizes. Thus if you really do want to show the relative sizes of the stars you have a dynamic range problem.

The conventional way to deal with this would be to use a logarithmic scale, such that each increment in size corresponds to a *multiple* of the one below. e.g. Make your plotted radii proportional to $\log\_{10} R\_{\rm rel}$.

EDIT: In response to altered emphasis of question.

It seems you no longer want to scale the stars according to their actual radius, but rather according to their brightness. The logarithmic scaling is therefore already handled by the apparent magnitude (which is on a logarithmic scale).

Therefore all you need to do is decide what your smallest and largst radius are and compare that with the brightest and faintest magnitudes you want to plot.

e.g. If your biggest star is 5 units and your smallest is 0 units, and your bright and faint limits are $m\_{\rm bright}$ and $m\_{\rm faint}$ respectively, then the size of an arbitrary star of magnitude $m$ is
$$ r =\frac{5(m -m\_{\rm faint})}{m\_{\rm bright} - m\_{\rm faint}} \ .$$

And if you want your faintest stars to be size 1 and brightest to be 5, this modifies to
$$ r =\frac{4(m -m\_{\rm faint})}{m\_{\rm bright} - m\_{\rm faint}} +1 \ .$$

Yet another alternative would be to make the *area* proportional to magnitude. Again, scaling between radii of 5 and 1:

$$ r^2 =\frac{24(m -m\_{\rm faint})}{m\_{\rm bright} - m\_{\rm faint}} +1 \ .$$

> **Comments:**
> **username_3**: Minimum size should be nonzero, and a linear function of *m* is too steep at the dim end.  
> **username_2**: @MikeG Your solution just scales as square root of flux and goes down by a factor of 1.6 for every magnitude! Minimum size can be set to whatever you like by adding a constant. Mine scales linearly with magnitude which is how the eye works.  
> **username_3**: With the second formula, r(0) / r(1) = 1.15, and r(5) / r(6) = 1.54.  

---

### Answer by username_3 on 2020-05-31. Score: 2

The SDSS exercise shows how to estimate a star's actual radius.
If you use this radius, you should also use different model materials for different color index values, since luminosity per unit area is a function of temperature.
If you prefer to avoid that complexity, base your model stars' radii on visual magnitude alone.
If you put the model stars at a uniform distance from the observer, use apparent magnitude instead of absolute magnitude.

Suppose your celestial sphere radius is 1000 units, and you want [Sirius](https://en.wikipedia.org/wiki/Sirius) (apparent magnitude *m*min = -1.45) to have an apparent angular radius of 5 milliradians.
Then the Sirius model radius *r*max would be 5 units, and a star of apparent magnitude *m* would have model radius
$$\begin{align}
r(m) &= r\_\mathrm{max} \times 10^{(m\_\mathrm{min} - m)/5} \\
&= 5 \times 10^{-1.45 / 5} \times 10^{-m/5} \\
&= 2.6~e^{-0.46~m}
\end{align}$$

If you also wish to set a minimum star model radius,
try *r(m) = beam* where
$$\begin{align}
a &= \frac{\ln r\_{\mathrm{min}} - \ln r\_{\mathrm{max}}}{m\_{\mathrm{max}} - m\_{\mathrm{min}}} \\
\\
b &= r\_{\mathrm{max}}~e^{-a~m\_{\mathrm{min}}} = r(0)\\
\end{align}$$

For example, to get *r*(6.0) = 0.5 with *r*(-1.45) = 5 as above, you could use
$$ r(m) = 3.2~e^{-0.31~m} $$

These model radii are nowhere near reality but should produce a recognizable night sky.
In real life the [Sun's radius](https://en.wikipedia.org/wiki/Solar_radius) is about 2.3×10-8 pc.

> **Comments:**
> **username_0**: what does the m subscript min stand for?  
> **username_3**: @SidS The apparent magnitude of the brightest star.  
> **username_0**: I've implemented a slightly modified version of this equation - the result looks amazing, however, astronomy.net is still not able to detect the stars and constellations. Please refer to the edit that I've made to the question for more details. Thanks!  
> **username_2**: The Hipparcos catalogue has stars between apparent magnitudes -1.4 and 8. Your radii would be from 5 to 0.06 (or 0.16 at 6th mag). Contrary to the comment you attached to my answer, *your* prescription is too steep at faint magnitudes (and squared if you think the area is what represents apparent brightness), mine is much shallower. That is why it is hard to recognise constellations that are typically defined by stars having a 3-4 mag range. In your scheme this is a range of 16-43 in spot area.  
> **username_3**: @RobJeffries Added a minimum radius parameter while preserving r(0)/r(1) = r(5)/r(6).  

---

