Project: Milky Way Volume Estimate
Estimate the volume of the [[Milky Way]] Galaxy. Assume that the Milky Way Galaxy can be modeled by a disk with radius of 52,850 light-years and thickness of 1,000 light-years. Also assume a central bulge modeled as a sphere of radius 10,000 light-years. The disk should have a 10,000 light-year hole in it so we don't double count the volume included in the sphere.
See [[Cylinder#Right_circular_hollow_cylinder_(cylindrical_shell)|Cylinder Volume]] and [[Sphere#Enclosed_volume|Sphere Volume]]
Output
$ rustc MilkyWayVolume.rs
error[E0425]: cannot find value `PI` in this scope
--> MilkyWayVolume.rs:14:23
|
14 | let diskVolume:f64 = PI * pow(DISK_RADIUS - BULGE_RADIUS,2.f64) * DISK_THICKNESS;
| ^^ not found in this scope
|
help: consider importing one of these items
|
7 + use consts::PI;
|
7 + use std::f32::consts::PI;
|
error[E0425]: cannot find value `PI` in this scope
--> MilkyWayVolume.rs:15:43
|
15 | let sphereVolume:f64 = 4.0f64 / 3.0f64 * PI * pow(BULGE_RADIUS,3.0f64);
| ^^ not found in this scope
|
help: consider importing one of these items
|
7 + use consts::PI;
|
7 + use std::f32::consts::PI;
|
warning: unused import: `std::f64::consts`
--> MilkyWayVolume.rs:7:5
|
7 | use std::f64::consts;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0308]: mismatched types
--> MilkyWayVolume.rs:9:27
|
9 | static BULGE_RADIUS:f64 = 10000;
| ^^^^^
| |
| expected `f64`, found integer
| help: use a float literal: `10000.0`
error[E0308]: mismatched types
--> MilkyWayVolume.rs:10:26
|
10 | static DISK_RADIUS:f64 = 52850;
| ^^^^^
| |
| expected `f64`, found integer
| help: use a float literal: `52850.0`
error[E0308]: mismatched types
--> MilkyWayVolume.rs:11:29
|
11 | static DISK_THICKNESS:f64 = 1000;
| ^^^^
| |
| expected `f64`, found integer
| help: use a float literal: `1000.0`
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> MilkyWayVolume.rs:14:61
|
14 | let diskVolume:f64 = PI * pow(DISK_RADIUS - BULGE_RADIUS,2.f64) * DISK_THICKNESS;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
14 | let diskVolume:f64 = PI * pow(DISK_RADIUS - BULGE_RADIUS,2.0f64) * DISK_THICKNESS;
| +
error[E0425]: cannot find function `pow` in this scope
--> MilkyWayVolume.rs:14:28
|
14 | let diskVolume:f64 = PI * pow(DISK_RADIUS - BULGE_RADIUS,2.f64) * DISK_THICKNESS;
| ^^^ not found in this scope
error[E0425]: cannot find function `pow` in this scope
--> MilkyWayVolume.rs:15:48
|
15 | let sphereVolume:f64 = 4.0f64 / 3.0f64 * PI * pow(BULGE_RADIUS,3.0f64);
| ^^^ not found in this scope
error: aborting due to 8 previous errors; 1 warning emitted
Some errors have detailed explanations: E0308, E0425, E0610.
For more information about an error, try `rustc --explain E0308`.