import math
from stdutils import prettyFunction, inputAsDict

print("y = ax^2 + bx + c")
vals = inputAsDict(('a','b','c'))

calcs = {'x1': (-vals['b'] + math.sqrt(vals['b']**2 - 4*vals['a']*vals['c']))/(2*vals['a']), 'x2': (-vals['b'] - math.sqrt(vals['b']**2 - 4*vals['a']*vals['c']))/(2*vals['a'])}

print(prettyFunction("({x1},0),({x2},0)", calcs))
Ejemplo n.º 2
0
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('degree', 'minute', 'second', 'arc'))

vals['de'] = vals['degree'] + (vals['minute'] / 60) + (vals['second'] / 3600)
vals['ra'] = vals['de'] / 180
vals['rap'] = vals['ra'] * math.pi
vals['len'] = vals['arc'] / vals['ra']
vals['lenp'] = vals['arc'] / vals['rap']

print('')
print(
    prettyFunction(
        "{degree}{degree}{minute}\"{second}\' = {de}{degree} = {ra}{pi}",
        vals))
print(prettyFunction("Radius = {arc}/{ra}{pi} = {len}/{pi}", vals))
print(prettyFunction("{len}/{pi} {approx} {lenp}", vals))
from stdutils import prettyFunction, inputAsDict

print("Focus: (a,b)")
print("Directrix: y = c")

values = inputAsDict(('a','b','c'))
formatValues = {'a': -values['a'], 'b': values['b']**2-values['c']**2, 'c': 2*(values['b']-values['c'])}

print("The equation of the parabola is:")
print(prettyFunction("y=((x{a&})^2{b&})/{c}",formatValues))
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('degree','minute','second','arc'))

vals['de'] = vals['degree'] + (vals['minute']/60) + (vals['second']/3600)
vals['ra'] = vals['de']/180
vals['rap'] = vals['ra']*math.pi
vals['len'] = vals['arc']/vals['ra']
vals['lenp'] = vals['arc']/vals['rap']

print('')
print(prettyFunction("{degree}{degree}{minute}\"{second}\' = {de}{degree} = {ra}{pi}", vals))
print(prettyFunction("Radius = {arc}/{ra}{pi} = {len}/{pi}", vals))
print(prettyFunction("{len}/{pi} {approx} {lenp}", vals))
from stdutils import prettyFunction, inputAsDict

print("y = ax^2+bx+c\n")
values = inputAsDict(('a','b','c'))

computed = {'h': -values['b']/(2*values['a']), 'k': (4*values['a']*values['c']-values['b']**2)/(4*values['a'])}

print("Vertex of parabola:")
print(prettyFunction("({h},{k})", computed))
import math
from stdutils import prettyFunction, inputAsDict

print("y = ax^2 + bx + c")
vals = inputAsDict(('a', 'b', 'c'))

calcs = {
    'x1': (-vals['b'] + math.sqrt(vals['b']**2 - 4 * vals['a'] * vals['c'])) /
    (2 * vals['a']),
    'x2': (-vals['b'] - math.sqrt(vals['b']**2 - 4 * vals['a'] * vals['c'])) /
    (2 * vals['a'])
}

print(prettyFunction("({x1},0),({x2},0)", calcs))
# Calculate length of an arc using radius and Degrees Minutes and Seconds angle measurement

import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('degree', 'minute', 'second', 'radius'))

# Convert DMS to radians
vals['de'] = vals['degree'] + (vals['minute'] / 60) + (vals['second'] / 3600)
vals['ra'] = vals['de'] / 180
# Calculate arc length
vals['len'] = vals['radius'] * vals['r']
# Calculations with pi
vals['rap'] = vals['ra'] * math.pi
vals['lenp'] = vals['rap'] * vals['r']

# Print out values
print('')
print(
    prettyFunction(
        "{degree}{degree}{minute}\"{second}\' = {de}{degree} = {ra}{pi}",
        vals))
print(prettyFunction("Arc length = {ra}{pi} x {radius} = {len}{pi}", vals))
print(prettyFunction("{len}{pi} {approx} {lenp}", vals))
from stdutils import prettyFunction, inputAsDict

print("Focus: (a,b)")
print("Directrix: y = c")

values = inputAsDict(('a', 'b', 'c'))
formatValues = {
    'a': -values['a'],
    'b': values['b']**2 - values['c']**2,
    'c': 2 * (values['b'] - values['c'])
}

print("The equation of the parabola is:")
print(prettyFunction("y=((x{a&})^2{b&})/{c}", formatValues))
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict("SideA","AngleA","AngleB")

vals['rad'] = vals['degrees']/180
vals['radp'] = vals['rad']*math.pi
vals['floatDegrees'] = vals['degrees']

print('')
print(prettyFunction("{floatDegrees}{degree} = {rad}{pi} {approx} {radp}",vals))
# Calculate length of an arc using radius and radian angle measurement
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('radians', 'radius'))

# Calculate arc length
vals['len'] = vals['radians'] * vals['radius']
# Calculations with pi
vals['lenp'] = vals['rap'] * vals['radius']
vals['rap'] = vals['radians'] * math.pi

print('')
print(prettyFunction("{len}{pi} = {radians}{pi} x {radius}", vals))
print(prettyFunction("{len}{pi} {approx} {lenp}", vals))
# Calculate length of an arc using radius and Degrees Minutes and Seconds angle measurement

import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('degree','minute','second','radius'))

# Convert DMS to radians
vals['de'] = vals['degree'] + (vals['minute']/60) + (vals['second']/3600)
vals['ra'] = vals['de']/180
# Calculate arc length
vals['len'] = vals['radius']*vals['r']
# Calculations with pi
vals['rap'] = vals['ra']*math.pi
vals['lenp'] = vals['rap']*vals['r']

# Print out values
print('')
print(prettyFunction("{degree}{degree}{minute}\"{second}\' = {de}{degree} = {ra}{pi}", vals))
print(prettyFunction("Arc length = {ra}{pi} x {radius} = {len}{pi}", vals))
print(prettyFunction("{len}{pi} {approx} {lenp}", vals))
Ejemplo n.º 12
0
# Calculate length of an arc using radius and degree angle measurement

import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('d','r'))

# Convert degrees to radians
vals['ra'] = vals['d']/180
# Calculate arc length
vals['len'] = vals['ra']*vals['r']
# Calculations with pi
vals['rap'] = vals['ra']*math.pi
vals['lenp'] = vals['rap']*vals['r']

# Print out values
print('')
print(prettyFunction("Arc Length = ({d}{degree} x {pi}/180) x {r}", vals))
print(prettyFunction("{len}{pi} = {ra}{pi} x {r}", vals))
print(prettyFunction("{len}{pi} {approx} {lenp}", vals))
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('radians','arc'))

vals['rap'] = vals['radians']*math.pi
vals['len'] = vals['arc']/vals['ra']
vals['lenp'] = vals['arc']/vals['rap']

print('')
print(prettyFunction("Radius = {arc}/{radians}{pi} = {len}/{pi}", vals))
print(prettyFunction("{len}/{pi} {approx} {lenp}", vals))
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict(('degree','arc'))

vals['ra'] = vals['degree']/180
vals['rap'] = vals['ra']*math.pi
vals['len'] = vals['arc']/vals['ra']
vals['lenp'] = vals['arc']/vals['rap']

print('')
print(prettyFunction("Radius = {arc}/({degree}{degree} x {pi} / 180)", vals))
print(prettyFunction("Radius = {arc}/{ra}{pi} = {len}/{pi}", vals))
print(prettyFunction("{len}/{pi} {approx} {lenp}", vals))
from stdutils import prettyFunction, inputAsDict

print("y = ax^2+bx+c\n")
values = inputAsDict(('a', 'b', 'c'))

computed = {
    'h': -values['b'] / (2 * values['a']),
    'k': (4 * values['a'] * values['c'] - values['b']**2) / (4 * values['a'])
}

print("Vertex of parabola:")
print(prettyFunction("({h},{k})", computed))
Ejemplo n.º 16
0
import math
from stdutils import prettyFunction, inputAsDict

vals = inputAsDict("SideA", "AngleA", "AngleB")

vals['rad'] = vals['degrees'] / 180
vals['radp'] = vals['rad'] * math.pi
vals['floatDegrees'] = vals['degrees']

print('')
print(
    prettyFunction("{floatDegrees}{degree} = {rad}{pi} {approx} {radp}", vals))