radboy 0.0.714__py3-none-any.whl → 0.0.716__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of radboy might be problematic. Click here for more details.

@@ -28,6 +28,388 @@ import decimal
28
28
  from decimal import localcontext,Decimal
29
29
  unit_registry=pint.UnitRegistry()
30
30
  import math
31
+
32
+ def volume():
33
+ with localcontext() as ctx:
34
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
35
+ #print(f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow}")
36
+ height=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} height?: ",helpText="height=1",data="dec.dec")
37
+ if height is None:
38
+ return
39
+ elif height in ['d',]:
40
+ height=Decimal('1')
41
+
42
+ width=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} width?: ",helpText="width=1 ",data="dec.dec")
43
+ if width is None:
44
+ return
45
+ elif width in ['d',]:
46
+ width=Decimal('1')
47
+
48
+
49
+
50
+ length=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} length?: ",helpText="length=1",data="dec.dec")
51
+ if length is None:
52
+ return
53
+ elif length in ['d',]:
54
+ length=Decimal('1')
55
+
56
+ return length*width*height
57
+
58
+ def volume_pint():
59
+ with localcontext() as ctx:
60
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
61
+ height=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} height?: ",helpText="height=1",data="string")
62
+ if height is None:
63
+ return
64
+ elif height in ['d',]:
65
+ height='1'
66
+
67
+ width=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} width?: ",helpText="width=1 ",data="string")
68
+ if width is None:
69
+ return
70
+ elif width in ['d',]:
71
+ width='1'
72
+
73
+
74
+
75
+ length=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} length?: ",helpText="length=1",data="string")
76
+ if length is None:
77
+ return
78
+ elif length in ['d',]:
79
+ length='1'
80
+
81
+ return unit_registry.Quantity(length)*unit_registry.Quantity(width)*unit_registry.Quantity(height)
82
+
83
+ def inductance_pint():
84
+ with localcontext() as ctx:
85
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
86
+ relative_permeability=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} relative_permeability?: ",helpText="relative_permeability(air)=1",data="string")
87
+ if relative_permeability is None:
88
+ return
89
+ elif relative_permeability in ['d',]:
90
+ relative_permeability='1'
91
+ relative_permeability=float(relative_permeability)
92
+
93
+ turns_of_wire_on_coil=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} turns_of_wire_on_coil?: ",helpText="turns_of_wire_on_coil=1",data="string")
94
+ if turns_of_wire_on_coil is None:
95
+ return
96
+ elif turns_of_wire_on_coil in ['d',]:
97
+ turns_of_wire_on_coil='1'
98
+ turns_of_wire_on_coil=int(turns_of_wire_on_coil)
99
+
100
+ #convert to meters
101
+ core_cross_sectional_area_meters=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} core_cross_sectional_area_meters?: ",helpText="core_cross_sectional_area_meters=1",data="string")
102
+ if core_cross_sectional_area_meters is None:
103
+ return
104
+ elif core_cross_sectional_area_meters in ['d',]:
105
+ core_cross_sectional_area_meters='1m'
106
+ try:
107
+ core_cross_sectional_area_meters=unit_registry.Quantity(core_cross_sectional_area_meters).to("meters")
108
+ except Exception as e:
109
+ print(e,"defaulting to meters")
110
+ core_cross_sectional_area_meters=unit_registry.Quantity(f"{core_cross_sectional_area_meters} meters")
111
+
112
+ length_of_coil_meters=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} length_of_coil_meters?: ",helpText="length_of_coil_meters=1",data="string")
113
+ if length_of_coil_meters is None:
114
+ return
115
+ elif length_of_coil_meters in ['d',]:
116
+ length_of_coil_meters='1m'
117
+ try:
118
+ length_of_coil_meters=unit_registry.Quantity(length_of_coil_meters).to('meters')
119
+ except Exception as e:
120
+ print(e,"defaulting to meters")
121
+ length_of_coil_meters=unit_registry.Quantity(f"{length_of_coil_meters} meters")
122
+
123
+ numerator=((turns_of_wire_on_coil**2)*core_cross_sectional_area_meters)
124
+ f=relative_permeability*(numerator/length_of_coil_meters)*1.26e-6
125
+ f=unit_registry.Quantity(f"{f.magnitude} H")
126
+ return f
127
+
128
+ def resonant_inductance():
129
+ with localcontext() as ctx:
130
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
131
+ hertz=1e9
132
+ while True:
133
+ try:
134
+ hertz=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} frequency in hertz[530 kilohertz]? ",helpText="frequency in hertz",data="string")
135
+ if hertz is None:
136
+ return
137
+ elif hertz in ['d','']:
138
+ hertz="530 megahertz"
139
+ print(hertz)
140
+ x=unit_registry.Quantity(hertz)
141
+ if x:
142
+ hertz=x.to("hertz")
143
+ else:
144
+ hertz=1e6
145
+ break
146
+ except Exception as e:
147
+ print(e)
148
+
149
+
150
+ while True:
151
+ try:
152
+ capacitance=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} capacitance[365 picofarads]? ",helpText="capacitance in farads",data="string")
153
+ if capacitance is None:
154
+ return
155
+ elif capacitance in ['d',]:
156
+ capacitance="365 picofarads"
157
+ x=unit_registry.Quantity(capacitance)
158
+ if x:
159
+ x=x.to("farads")
160
+ farads=x.magnitude
161
+ break
162
+ except Exception as e:
163
+ print(e)
164
+
165
+ inductance=1/(decc(4*math.pi**2)*decc(hertz.magnitude**2,cf=13)*decc(farads,cf=13))
166
+
167
+ L=unit_registry.Quantity(inductance,"henry")
168
+ return L
169
+
170
+ def air_coil_cap():
171
+ with localcontext() as ctx:
172
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
173
+ '''C = 1 / (4π²f²L)'''
174
+ while True:
175
+ try:
176
+ frequency=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} frequency? ",helpText="frequency",data="string")
177
+ if frequency is None:
178
+ return
179
+ elif frequency in ['d',]:
180
+ frequency="1410 kilohertz"
181
+ x=unit_registry.Quantity(frequency)
182
+ if x:
183
+ x=x.to("hertz")
184
+ frequency=decc(x.magnitude**2)
185
+ break
186
+ except Exception as e:
187
+ print(e)
188
+
189
+ while True:
190
+ try:
191
+ inductance=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} inductance(356 microhenry): ",helpText="coil inductance",data="string")
192
+ if inductance is None:
193
+ return
194
+ elif inductance in ['d',]:
195
+ inductance="356 microhenry"
196
+ x=unit_registry.Quantity(inductance)
197
+ if x:
198
+ x=x.to("henry")
199
+ inductance=decc(x.magnitude,cf=20)
200
+ break
201
+ except Exception as e:
202
+ print(e)
203
+
204
+
205
+
206
+ farads=1/(inductance*frequency*decc(4*math.pi**2))
207
+ return unit_registry.Quantity(farads,"farad")
208
+
209
+ def air_coil():
210
+ with localcontext() as ctx:
211
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
212
+ '''
213
+ The formula for inductance - using toilet rolls, PVC pipe etc. can be well approximated by:
214
+
215
+
216
+ 0.394 * r2 * N2
217
+ Inductance L = ________________
218
+ ( 9 *r ) + ( 10 * Len)
219
+ Here:
220
+ N = number of turns
221
+ r = radius of the coil i.e. form diameter (in cm.) divided by 2
222
+ Len = length of the coil - again in cm.
223
+ L = inductance in uH.
224
+ * = multiply by
225
+ '''
226
+ while True:
227
+ try:
228
+ diameter=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} diameter in cm [2 cm]? ",helpText="diamater of coil",data="string")
229
+ if diameter is None:
230
+ return
231
+ elif diameter in ['d',]:
232
+ diameter="2 cm"
233
+ x=unit_registry.Quantity(diameter)
234
+ if x:
235
+ x=x.to("centimeter")
236
+ diameter=x.magnitude
237
+ break
238
+ except Exception as e:
239
+ print(e)
240
+ radius=decc(diameter/2)
241
+ while True:
242
+ try:
243
+ length=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} length in cm [2 cm]? ",helpText="length of coil",data="string")
244
+ if length is None:
245
+ return
246
+ elif length in ['d',]:
247
+ length="2 cm"
248
+ x=unit_registry.Quantity(length)
249
+ if x:
250
+ x=x.to("centimeter")
251
+ length=x.magnitude
252
+ break
253
+ except Exception as e:
254
+ print(e)
255
+ while True:
256
+ try:
257
+ turns=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} number of turns? ",helpText="turns of wire",data="integer")
258
+ if turns is None:
259
+ return
260
+ elif turns in ['d',]:
261
+ turns=1
262
+ LTop=decc(0.394)*decc(radius**2)*decc(turns**2)
263
+ LBottom=(decc(9)*radius)+decc(length*10)
264
+ L=LTop/LBottom
265
+ print(pint.Quantity(L,'microhenry'))
266
+ different_turns=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} use a different number of turns?",helpText="yes or no",data="boolean")
267
+ if different_turns is None:
268
+ return
269
+ elif different_turns in ['d',True]:
270
+ continue
271
+ break
272
+ except Exception as e:
273
+ print(e)
274
+
275
+
276
+ return pint.Quantity(L,'microhenry')
277
+
278
+ def circumference_diameter():
279
+ with localcontext() as ctx:
280
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
281
+ radius=0
282
+ while True:
283
+ try:
284
+ diameter=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} diameter unit[4 cm]? ",helpText="diamater with unit",data="string")
285
+ if diameter is None:
286
+ return
287
+ elif diameter in ['d',]:
288
+ diameter="4 cm"
289
+ x=unit_registry.Quantity(diameter)
290
+ radius=pint.Quantity(decc(x.magnitude/2),x.units)
291
+ break
292
+ except Exception as e:
293
+ print(e)
294
+ if isinstance(radius,pint.registry.Quantity):
295
+ result=decc(2*math.pi)*decc(radius.magnitude)
296
+
297
+ return pint.Quantity(result,radius.units)
298
+ else:
299
+ return
300
+
301
+ def circumference_radius():
302
+ with localcontext() as ctx:
303
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
304
+ radius=0
305
+ while True:
306
+ try:
307
+ diameter=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} radius unit[2 cm]? ",helpText="radius with unit",data="string")
308
+ if diameter is None:
309
+ return
310
+ elif diameter in ['d',]:
311
+ diameter="2 cm"
312
+ x=unit_registry.Quantity(diameter)
313
+ radius=pint.Quantity(decc(x.magnitude),x.units)
314
+ break
315
+ except Exception as e:
316
+ print(e)
317
+ if isinstance(radius,pint.registry.Quantity):
318
+ result=decc(2*math.pi)*decc(radius.magnitude)
319
+
320
+ return pint.Quantity(result,radius.units)
321
+ else:
322
+ return
323
+
324
+ def area_of_circle_radius():
325
+ with localcontext() as ctx:
326
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
327
+ '''
328
+ A = πr²
329
+ '''
330
+ radius=0
331
+ while True:
332
+ try:
333
+ diameter=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} radius unit[2 cm]? ",helpText="radius with unit",data="string")
334
+ if diameter is None:
335
+ return
336
+ elif diameter in ['d',]:
337
+ diameter="2 cm"
338
+ x=unit_registry.Quantity(diameter)
339
+ radius=pint.Quantity(decc(x.magnitude),x.units)
340
+ break
341
+ except Exception as e:
342
+ print(e)
343
+ if isinstance(radius,pint.registry.Quantity):
344
+ result=decc(math.pi)*decc(radius.magnitude**2)
345
+
346
+ return pint.Quantity(result,radius.units)
347
+ else:
348
+ return
349
+
350
+ def lc_frequency():
351
+ with localcontext() as ctx:
352
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
353
+ inductance=None
354
+ capacitance=None
355
+ while True:
356
+ try:
357
+ inductance=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} inductance(356 microhenry): ",helpText="coil inductance",data="string")
358
+ if inductance is None:
359
+ return
360
+ elif inductance in ['d',]:
361
+ inductance="356 microhenry"
362
+ x=unit_registry.Quantity(inductance)
363
+ if x:
364
+ x=x.to("henry")
365
+ inductance=decc(x.magnitude,cf=20)
366
+ break
367
+ except Exception as e:
368
+ print(e)
369
+ while True:
370
+ try:
371
+ capacitance=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} capacitance[365 picofarads]? ",helpText="capacitance in farads",data="string")
372
+ if capacitance is None:
373
+ return
374
+ elif capacitance in ['d',]:
375
+ capacitance="365 picofarads"
376
+ x=unit_registry.Quantity(capacitance)
377
+ if x:
378
+ x=x.to("farads")
379
+ farads=decc(x.magnitude,cf=20)
380
+ break
381
+ except Exception as e:
382
+ print(e)
383
+ frequency=1/(decc(2*math.pi)*decc(math.sqrt(farads*inductance),cf=20))
384
+ return unit_registry.Quantity(frequency,"hertz")
385
+
386
+ def area_of_circle_diameter():
387
+ with localcontext() as ctx:
388
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
389
+ '''
390
+ A = πr²
391
+ '''
392
+ radius=0
393
+ while True:
394
+ try:
395
+ diameter=Control(func=FormBuilderMkText,ptext=f"{Fore.light_green}Precision {ctx.prec}{Fore.light_yellow} diameter unit[4 cm]? ",helpText="diamater value with unit",data="string")
396
+ if diameter is None:
397
+ return
398
+ elif diameter in ['d',]:
399
+ diameter="4 cm"
400
+ x=unit_registry.Quantity(diameter)
401
+ radius=pint.Quantity(decc(x.magnitude/2),x.units)
402
+ break
403
+ except Exception as e:
404
+ print(e)
405
+ if isinstance(radius,pint.registry.Quantity):
406
+ result=decc(math.pi)*decc(radius.magnitude**2)
407
+
408
+ return pint.Quantity(result,radius.units)
409
+ else:
410
+ return
411
+
412
+
31
413
  def area_triangle():
32
414
  with localcontext() as ctx:
33
415
  ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
@@ -215,7 +597,7 @@ def AddNewTaxRate(excludes=['txrt_id','DTOE']):
215
597
  'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
216
598
  }
217
599
 
218
- fd=FormBuilder(data=fields)
600
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
219
601
  if fd is None:
220
602
  session.delete(tr)
221
603
  return
@@ -244,7 +626,7 @@ def GetTaxRate(excludes=['txrt_id','DTOE']):
244
626
  'type':str(i.type).lower()} for i in tr.__table__.columns if i.name not in excludes
245
627
  }
246
628
 
247
- fd=FormBuilder(data=fields,passThruText="GetTaxRate Search -> ")
629
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec} ; GetTaxRate Search -> ")
248
630
  if fd is None:
249
631
  return
250
632
  for k in fd:
@@ -297,7 +679,7 @@ def price_by_tax(total=False):
297
679
  'type':'dec.dec'
298
680
  }
299
681
  }
300
- fd=FormBuilder(data=fields,passThruText="Tax on Price ->")
682
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec} ; Tax on Price ->")
301
683
  if fd is None:
302
684
  return
303
685
  else:
@@ -329,7 +711,7 @@ def price_plus_crv_by_tax(total=False):
329
711
  'type':'dec.dec'
330
712
  }
331
713
  }
332
- fd=FormBuilder(data=fields,passThruText="Tax on (Price+CRV)")
714
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec};Tax on (Price+CRV)")
333
715
  if fd is None:
334
716
  return
335
717
  else:
@@ -493,7 +875,7 @@ def heronsFormula():
493
875
  'type':'dec.dec'
494
876
  },
495
877
  }
496
- fd=FormBuilder(data=fields)
878
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
497
879
  if fd is None:
498
880
  return
499
881
 
@@ -519,7 +901,7 @@ def volumeCylinderRadius():
519
901
  'type':'dec.dec'
520
902
  },
521
903
  }
522
- fd=FormBuilder(data=fields)
904
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
523
905
  if fd is None:
524
906
  return
525
907
 
@@ -542,7 +924,7 @@ def volumeCylinderDiameter():
542
924
  'type':'dec.dec'
543
925
  },
544
926
  }
545
- fd=FormBuilder(data=fields)
927
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
546
928
  if fd is None:
547
929
  return
548
930
 
@@ -565,7 +947,7 @@ def volumeConeRadius():
565
947
  'type':'dec.dec'
566
948
  },
567
949
  }
568
- fd=FormBuilder(data=fields)
950
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
569
951
  if fd is None:
570
952
  return
571
953
 
@@ -588,9 +970,148 @@ def volumeConeDiameter():
588
970
  'type':'dec.dec'
589
971
  },
590
972
  }
591
- fd=FormBuilder(data=fields)
973
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
592
974
  if fd is None:
593
975
  return
594
976
 
595
977
  volume=Decimal(1/3)*(Decimal(math.pi)*((fd['diameter']/2)**2)*fd['height'])
596
- return volume
978
+ return volume
979
+
980
+ def volumeHemisphereRadius():
981
+ with localcontext() as ctx:
982
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
983
+ '''
984
+ Volume of a hemisphere = (2/3) x 3.14 x r3
985
+ '''
986
+ fields={
987
+ 'radius':{
988
+ 'default':1,
989
+ 'type':'dec.dec'
990
+ },
991
+ }
992
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
993
+ if fd is None:
994
+ return
995
+
996
+ volume=Decimal(2/3)*Decimal(math.pi)*(fd['radius']**3)
997
+ return volume
998
+
999
+ def volumeHemisphereDiameter():
1000
+ with localcontext() as ctx:
1001
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
1002
+ '''
1003
+ Volume of a hemisphere = (2/3) x 3.14 x r3
1004
+ '''
1005
+ fields={
1006
+ 'diameter':{
1007
+ 'default':1,
1008
+ 'type':'dec.dec'
1009
+ },
1010
+ }
1011
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
1012
+ if fd is None:
1013
+ return
1014
+
1015
+ volume=Decimal(2/3)*Decimal(math.pi)*((fd['diameter']/2)**3)
1016
+ return volume
1017
+
1018
+ def areaCircleDiameter():
1019
+ with localcontext() as ctx:
1020
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
1021
+ '''
1022
+ Volume of a hemisphere = (2/3) x 3.14 x r3
1023
+ '''
1024
+ fields={
1025
+ 'diameter':{
1026
+ 'default':1,
1027
+ 'type':'dec.dec'
1028
+ },
1029
+ }
1030
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
1031
+ if fd is None:
1032
+ return
1033
+
1034
+ volume=Decimal(math.pi)*((fd['diameter']/2)**2)
1035
+ return volume
1036
+
1037
+
1038
+ def areaCircleRadius():
1039
+ with localcontext() as ctx:
1040
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
1041
+ '''
1042
+ Volume of a hemisphere = (2/3) x 3.14 x r3
1043
+ '''
1044
+ fields={
1045
+ 'radius':{
1046
+ 'default':1,
1047
+ 'type':'dec.dec'
1048
+ },
1049
+ }
1050
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
1051
+ if fd is None:
1052
+ return
1053
+
1054
+ volume=Decimal(math.pi)*((fd['radius'])**2)
1055
+ return volume
1056
+
1057
+ ###newest
1058
+ def circumferenceCircleRadiu():
1059
+ #get the circumference of a circle using radius
1060
+ with localcontext() as ctx:
1061
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
1062
+ '''
1063
+ 2πr
1064
+ '''
1065
+ fields={
1066
+ 'radius':{
1067
+ 'default':1,
1068
+ 'type':'dec.dec'
1069
+ },
1070
+ }
1071
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
1072
+ if fd is None:
1073
+ return
1074
+
1075
+ circumference=2*Deimal(math.pi)*fd['radius']
1076
+ return circumference
1077
+
1078
+ def circumferenceCircleDiameter():
1079
+ #get the circumference of a circle using diameter
1080
+ with localcontext() as ctx:
1081
+ ctx.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
1082
+ '''
1083
+ 2π(d/2)
1084
+ '''
1085
+ fields={
1086
+ 'diameter':{
1087
+ 'default':1,
1088
+ 'type':'dec.dec'
1089
+ },
1090
+ }
1091
+ fd=FormBuilder(data=fields,passThruText=f"Precision {ctx.prec}")
1092
+ if fd is None:
1093
+ return
1094
+
1095
+ circumference=2*Deimal(math.pi)*Decimal(fd['diameter']/2)
1096
+ return circumference
1097
+
1098
+ '''
1099
+ Ellipse: area=πab
1100
+ , where 2a
1101
+ and 2b
1102
+ are the lengths of the axes of the ellipse.
1103
+
1104
+ Sphere: vol=4πr3/3
1105
+ , surface area=4πr2
1106
+ .
1107
+
1108
+ Cylinder: vol=πr2h
1109
+ , lateral area=2πrh
1110
+ , total surface area=2πrh+2πr2
1111
+ .
1112
+
1113
+
1114
+ Cone: vol=πr2h/3
1115
+ , lateral area=πrr2+h2−−−−−−√
1116
+ , total surface area=πrr2+h2−−−−−−√+πr2
1117
+ '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.714
3
+ Version: 0.0.716
4
4
  Summary: A Retail Calculator for Android/Linux
5
5
  Author: Carl Joseph Hirner III
6
6
  Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>