VofRsphere

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 5.1, Creation date: 2021-11-26, Last change: 2025-09-15

Lead or steel balls must be installed in cavities to create ballast



See Also: V2A

Example Illustration

 missing image of VofRsphere(R,M)

Syntax

[V,W,M]=VofRsphere([R,M])

Input Parameter

R: Radius [r h]; default is [r r]
M: Material such as 'Fe', 'Pb', 'Si'

Output Parameter

V: Volume
W: Weight
M: Material

Examples


VofRsphere(5,'Pb'); % Lead sphere with 10mm diameter




Copyright 2021-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function calculates the volume and weight of a sphere made of a specified material. It is designed to assist in creating ballast using lead or steel balls.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the radius R from the input parameters. If R is a single value, set it to [R, R]. Assign H as the second element of R and R as the first element.
  2. Retrieve the material M from the input parameters. Default is 'Fe'.
  3. Define a table Tab with materials and their densities: 'Fe' (7.8352), 'Pb' (11.3), 'Si' (2.33), 'Holz' (0.755), 'Papier' (0.755).
  4. If M is a string, find the corresponding density sw from the table. If M is not a string, use M as the density.
  5. Calculate the volume V of the sphere using the formula V = 4.1888 * R * R * H (approximating 4/3 * pi).
  6. Calculate the volume Q of a block with the same dimensions using Q = 8 * R * R * H.
  7. Calculate the weight W of the sphere using W = V * sw / 1000.
  8. If no output is requested, print the details of the sphere and block, including diameter, radius, material, volume, and weight.

Example

To calculate the volume and weight of a lead sphere with a 10mm diameter, use:

VofRsphere(5, 'Pb');
Algorithm explaination created using ChatGPT on 2025-08-19 06:46. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21