41 Cistern Program
|
08-17-2016, 04:47 AM
Post: #21
|
|||
|
|||
RE: 41 Cistern Program
(08-16-2016 07:08 PM)Gerson W. Barbosa Wrote: Or, regardless the angle mode, but at the cost of 2.5 bytes and a few milliseconds more: A faster 55-byte solution: Code:
3 2 1 → 7.37021819169 (0.0497 s, 50g) An even faster 60-byte solution: Code:
3 2 1 → 7.37021819169 (0.0352 s, 50g) These require RADIANS mode, however. Also, 2.5 more bytes on the HP-48 (ROT ROT instead of UNROT). ------------------------------------------------------------------------------------ \(V=L\cdot R^{2}\cdot \left \{ Arg\left [ \left ( 1-\frac{H}{R} \right ),\sqrt{1-\left ( 1-\frac{H}{R} \right )^{2}} \right ] - \left ( 1-\frac{H}{R} \right )\cdot \sqrt{1-\left ( 1-\frac{H}{R} \right )^{2}} \right \}\) where \(Arg(a,b) = \tan^{-1}\left ( \frac{b}{a} \right )\) ------------------------------------------------------------------------------------ |
|||
08-17-2016, 06:08 AM
Post: #22
|
|||
|
|||
RE: 41 Cistern Program | |||
08-17-2016, 06:46 AM
Post: #23
|
|||
|
|||
RE: 41 Cistern Program
(08-17-2016 06:08 AM)wojtek Wrote:Gerson W. Barbosa ' Wrote: Or, regardless the angle mode, but at the cost of 2.5 bytes and a few milliseconds more: How about the original hp-41 program, was it ever found? "To live or die by your own sword one must first learn to wield it aptly." |
|||
08-17-2016, 09:03 AM
Post: #24
|
|||
|
|||
RE: 41 Cistern Program | |||
08-17-2016, 01:30 PM
(This post was last modified: 08-17-2016 01:43 PM by Dieter.)
Post: #25
|
|||
|
|||
RE: 41 Cistern Program
(08-17-2016 06:46 AM)Ángel Martin Wrote: How about the original hp-41 program, was it ever found? Simply make your own. ;-) This version works in any angular mode, be it DEG, RAD or GRAD. It also avoids calculating arccos(1–x) which may get inaccurate for small x. Instead a method with arcsin is used. Code: LBL"CISTERN" If switching to RAD is OK and prompting is not required, here is a shorter version: Code: LBL"CISTERN" Or, if your prefer degrees: Code: LBL"CISTERN" Example: L=10 r=3 h=1 => V=30,9748 Dieter |
|||
08-17-2016, 02:13 PM
(This post was last modified: 08-17-2016 07:58 PM by wojtek.)
Post: #26
|
|||
|
|||
RE: 41 Cistern Program
« Simply make your own. ;-) »
This is perhaps no so simple as it looks. Original program probably include calculations of partial volume of heads of the vessel. Calculating heads' volume can be not so simple as they can be of different shapes, for example spherical, conical etc. As far as I found in the internet calculations of heads' volume in most cases are estimated, the code for it being much longer than for simple cylinder body. On the other hand volume of heads is important as they have significant percentage of the whole volume. It should be said here as well that body of the vessel can have different cross-sections, not only circular, but elliptical for example. If the original program takes account af all this it certainly must be complicated |
|||
08-17-2016, 02:22 PM
Post: #27
|
|||
|
|||
RE: 41 Cistern Program
And the original program allowed for a sloped tank if necessary. The great programs in the responses here all assume a perfect cylinder on a level base. The program in the original post allowed for different end shapes and slopes, definitely one worth resurrecting from the dead.
Steve In order of appearance: HP 41CV, CMT-MCGPS, HP 41CX, DM 41, DM 42 |
|||
08-17-2016, 04:51 PM
(This post was last modified: 08-17-2016 04:53 PM by aurelio.)
Post: #28
|
|||
|
|||
RE: 41 Cistern Program
(08-17-2016 02:13 PM)wojtek Wrote: « Simply make your own. ;-) » Here they take in account also the different shape of the heads, unfortunately not a case of sloped vessels.. This can help of course, but is not actually what we are looking for, cause it is a "on-line" calculation. By the way I don't understand very well the graphical rapresentation on the right |
|||
08-18-2016, 02:44 AM
(This post was last modified: 08-18-2016 02:50 AM by Gerson W. Barbosa.)
Post: #29
|
|||
|
|||
RE: 41 Cistern Program
(08-17-2016 06:08 AM)wojtek Wrote:Gerson W. Barbosa ' Wrote: Or, regardless the angle mode, but at the cost of 2.5 bytes and a few milliseconds more: 15? I've counted only 8. Wait, 11 now: « OVER SQ UNROT SWAP1. UNROT / - DUP ACOS SIN DUP2 R→C ARG UNROT * - * * » « OVER SQ UNROT 1 UNROT SWAP / - DUP ASIN COS * LASTARG R→C ARG SWAP - * * » « OVER / 1. SWAP - DUP ACOS SIN * LASTARG R→C ARG SWAP - OVER * * * » 57.5, 57.5 and 55 bytes, respectively. All require RAD mode. No better than the previous ones, just another attempt. Test with L = 4, R = 3 and H = 2. The exact result is '4*(9*ATAN(√8)-√8)' (33.0008305252831281644394). If I had to discard some, I think I would keep the three programs in post #21. |
|||
08-19-2016, 05:03 AM
Post: #30
|
|||
|
|||
RE: 41 Cistern Program
(08-17-2016 04:51 PM)aurelio Wrote: Here they take in account also the different shape of the heads, unfortunately not a case of sloped vessels.. The Oil & Gas article has the formulas. For instance, my unoptimized program for the elliptical head case (237 bytes) gives 0.916297857295 m^3 for D=1m, L=2m, a=0.25m and H=0.5m. No stack-only code this time :-) Gerson. |
|||
08-19-2016, 08:23 AM
(This post was last modified: 08-19-2016 08:25 AM by Csaba Tizedes.)
Post: #31
|
|||
|
|||
RE: 41 Cistern Program
HP 15C version discussed in Hungarian Calculator Google group - With spherical ends and cylindrial body:
AutoCAD calculation: https://groups.google.com/d/msg/szamolog...Xs0EoO_EQJ https://lh3.googleusercontent.com/-50Pg4...25A1ly.JPG And the 15C program is here: https://groups.google.com/d/msg/szamolog...cXHZYrFhUJ Happy translating! Csaba |
|||
08-19-2016, 11:54 AM
Post: #32
|
|||
|
|||
RE: 41 Cistern Program | |||
08-19-2016, 12:49 PM
Post: #33
|
|||
|
|||
RE: 41 Cistern Program
(08-19-2016 08:23 AM)Csaba Tizedes Wrote: https://groups.google.com/d/msg/szamolog...Xs0EoO_EQJ On android I can see only source of html header, no any data, no program... |
|||
08-19-2016, 01:13 PM
(This post was last modified: 08-19-2016 07:31 PM by Gerson W. Barbosa.)
Post: #34
|
|||
|
|||
RE: 41 Cistern Program
(08-19-2016 05:03 AM)Gerson W. Barbosa Wrote:(08-17-2016 04:51 PM)aurelio Wrote: Here they take in account also the different shape of the heads, unfortunately not a case of sloped vessels.. (08-19-2016 05:03 AM)Gerson W. Barbosa Wrote:(08-17-2016 04:51 PM)aurelio Wrote: Here they take in account also the different shape of the heads, unfortunately not a case of sloped vessels.. Code:
Fill the stack with L, D, a, h. For a spherical tank, just make L=0 and a = D/2 (for instance, L=0, D=4, a=2 and h=4 --> a full spherical tank). This can be simplified as Code:
The angle mode is irrelevant on the HP 50g if IM(ACOSH) is used instead of ACOS. Size has now been reduced to 191 bytes. 2 1 0.25 0.5 --> 0.916297857295 0 4 2 4 --> 33.5103216383 (32*π/3) 0 4 2 2 -->16.7551608191 (16*π/3) Is the latter half full or half empty? :-) ---------------------------------------------------------------------------------------- \(V= L\left [ \frac{D^{2}}{4}\cos^{-1}\left ( 1-\frac{2h}{D} \right )+ \sqrt{h\left ( D-h \right )}\left ( h-\frac{D}{2} \right ) \right ] +\pi a h^{2}\left ( 1-\frac{2h}{3D} \right )\) Edited to include diagram and equation |
|||
08-19-2016, 04:55 PM
Post: #35
|
|||
|
|||
RE: 41 Cistern Program
(08-19-2016 12:49 PM)wojtek Wrote: groups.google.com - On android I can see only source of html header, no any data, no program...It means only that the Google needs to evolve. If Android which is OS of Google and the Google groups is owned by Google also, but the Android can not to handle Google groups messages, that is a big FAIL. Same thing like Leonardo can not to read his own mirror-writings... Csaba |
|||
08-19-2016, 05:07 PM
Post: #36
|
|||
|
|||
RE: 41 Cistern Program
(08-19-2016 04:55 PM)Csaba Tizedes Wrote:Update: I checked under another user but logged in Google and works perfectly. Maybe you needs to login into your Google account?(08-19-2016 12:49 PM)wojtek Wrote: groups.google.com - On android I can see only source of html header, no any data, no program...It means only that the Google needs to evolve. The text is here but I guess this will not really helpful (Hungarian text only): Code:
Csaba |
|||
08-19-2016, 07:18 PM
(This post was last modified: 08-19-2016 07:24 PM by wojtek.)
Post: #37
|
|||
|
|||
RE: 41 Cistern Program
Csaba Wrote:
"Update: I checked under another user but logged in Google and works perfectly. Maybe you needs to login into your Google account?" I cannot login 'cos I do not see login window. My android is 2.3.3 but I do not think the problem is here. I won't change my device because it is first and last android device I bought. Anyway google apps should accept all google devices regardless of model number. |
|||
08-19-2016, 08:37 PM
(This post was last modified: 08-19-2016 08:40 PM by Gerson W. Barbosa.)
Post: #38
|
|||
|
|||
RE: 41 Cistern Program
(08-19-2016 01:13 PM)Gerson W. Barbosa Wrote: Or, stack-only, 122.5 bytes: Code:
This of course can be optimized even further, either for size or speed. Size optimization left out as an exercise for the interested reader :-) L D a h --> Volume 2 1 0.25 0.5 --> 0.916297857295 0 4 2 4 --> 33.5103216382 (32*π/3) 0 4 2 2 --> 16.7551608191 (16*π/3) |
|||
08-19-2016, 10:05 PM
(This post was last modified: 08-19-2016 10:09 PM by aurelio.)
Post: #39
|
|||
|
|||
RE: 41 Cistern Program
Great job Gerson!!!
I lost your previous ....sorry strange that in solving the problem is always considered as a parameter the cross section of the head, but not the section, which is assumed always circular Vessels often have elliptical section If I'm not wrong also Oil & Gas Journal article did not consider this case |
|||
08-19-2016, 11:29 PM
Post: #40
|
|||
|
|||
RE: 41 Cistern Program | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)