Last active
April 15, 2020 22:53
-
-
Save rgov/63f2f6267fd84e78b0e393451a081ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Compare the rumored device size of a 5.4" iPhone 12 to the beloved first- | |
generation iPhone SE. | |
Assumes that the iPhone 12 will have the same screen aspect ratio as the | |
iPhone 11. | |
''' | |
class iPhone: | |
def __init__(self, body_width, body_height, screen_size, aspect_ratio): | |
self.body_width, self.body_height = body_width, body_height | |
self.screen_size, self.aspect_ratio = screen_size, aspect_ratio | |
@property | |
def screen_height(self): | |
return ((self.screen_size**2) / (self.aspect_ratio**2 + 1.0))**0.5 | |
@property | |
def screen_width(self): | |
return self.aspect_ratio * self.screen_height | |
@property | |
def bezel_width(self): | |
return self.body_width - self.screen_width | |
@property | |
def bezel_height(self): | |
return self.body_height - self.screen_height | |
@property | |
def body_area(self): | |
return self.body_width * self.body_height | |
@property | |
def screen_area(self): | |
return self.screen_width * self.screen_height | |
# https://support.apple.com/kb/SP738 | |
iPhoneSE = iPhone(2.31, 4.87, 4.0, 640.0/1136.0) | |
# https://support.apple.com/kb/SP770 | |
iPhoneX = iPhone(2.79, 5.65, 5.8, 1125.0/2436.0) | |
# https://support.apple.com/kb/SP779 | |
iPhoneXS = iPhone(2.79, 5.65, 5.8, 1125.0/2436.0) | |
# https://support.apple.com/kb/SP780 | |
iPhoneXSMax = iPhone(3.05, 6.20, 6.5, 1242.0/2688.0) | |
# https://support.apple.com/kb/SP781 | |
iPhoneXR = iPhone(2.98, 5.94, 6.1, 828.0/1792.0) | |
# https://www.apple.com/iphone-11/specs/ | |
iPhone11 = iPhone(2.98, 5.94, 6.1, 828.0/1792.0) | |
# https://www.apple.com/iphone-11-pro/specs/ | |
iPhone11Pro = iPhone(2.81, 5.67, 5.8, 1125.0/2436.0) | |
iPhone11ProMax = iPhone(3.06, 6.22, 6.5, 1242.0/2688.0) | |
# ----- Speculation ------------------------------------------------------------ | |
import sympy | |
iPhone12 = iPhone(*sympy.symbols('body_width body_height'), | |
5.4, iPhone11.aspect_ratio) | |
# Solve for body size assuming same display bezels as iPhone 11 Pro, which is | |
# expected to use the same display technology (OLED) | |
iPhone12.body_width, iPhone12.body_height = next(iter(sympy.nonlinsolve(( | |
sympy.Eq(iPhone12.bezel_width, iPhone11Pro.bezel_width), | |
sympy.Eq(iPhone12.bezel_height, iPhone11Pro.bezel_height), | |
), (iPhone12.body_width, iPhone12.body_height)))) | |
print(f'iPhone 12 ({iPhone12.screen_size}") is ' | |
f'{iPhone12.body_width:.2f}x{iPhone12.body_height:.2f}"') | |
print('Body size is', | |
f'{100.0 * ((iPhone12.body_area / iPhoneSE.body_area) - 1.0):.2f}%', | |
'larger than iPhone SE') | |
print('Screen size is', | |
f'{100.0 * ((iPhone12.screen_area / iPhoneSE.screen_area) - 1.0):.2f}%', | |
'larger than iPhone SE') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment