help[
DownloadTélécharger
Actions
Vote :
ScreenshotAperçu

Informations
Catégorie :Category: nCreator TI-Nspire
Auteur Author: kboiiii
Type : Classeur 3.0.1
Page(s) : 1
Taille Size: 3.56 Ko KB
Mis en ligne Uploaded: 18/09/2025 - 20:27:00
Uploadeur Uploader: kboiiii (Profil)
Téléchargements Downloads: 1
Visibilité Visibility: Archive publique
Shortlink : https://tipla.net/a4848202
Type : Classeur 3.0.1
Page(s) : 1
Taille Size: 3.56 Ko KB
Mis en ligne Uploaded: 18/09/2025 - 20:27:00
Uploadeur Uploader: kboiiii (Profil)
Téléchargements Downloads: 1
Visibilité Visibility: Archive publique
Shortlink : https://tipla.net/a4848202
Description
Fichier Nspire généré sur TI-Planet.org.
Compatible OS 3.0 et ultérieurs.
<<
import math def get_vector_input(vector_name): print("--- Vector " + vector_name + " ---") while True: try: x = float(input("Enter x: ")) y = float(input("Enter y: ")) z = float(input("Enter z: ")) return [x, y, z] except ValueError: print("Error: Numbers only.") def run_geometry_menu(): while True: print("--- GEOMETRY ---") print("1. Circle") print("2. Sphere") print("3. Cylinder") print("4. Back") choice = input("Select: ") if choice == '1': try: r = float(input("Radius: ")) area = math.pi * r**2 perimeter = 2 * math.pi * r print("Area = " + str(area)) print("Perimeter = " + str(perimeter)) except ValueError: print("Error") elif choice == '2': try: r = float(input("Radius: ")) # FIXED: Changed 4/3 to 4.0/3.0 to ensure correct decimal division. volume = (4.0/3.0) * math.pi * r**3 surface_area = 4 * math.pi * r**2 print("Volume = " + str(volume)) print("Surface Area = " + str(surface_area)) except ValueError: print("Error") elif choice == '3': try: r = float(input("Radius: ")) h = float(input("Height: ")) volume = math.pi * r**2 * h surface_area = (2*math.pi*r*h) + (2*math.pi*r**2) print("Volume = " + str(volume)) print("Surface Area = " + str(surface_area)) except ValueError: print("Error") elif choice == '4': break else: print("Invalid choice") input("Press Enter") def calc_magnitude(): a = get_vector_input("A") mag = math.sqrt(a[0]**2 + a[1]**2 + a[2]**2) print("Magnitude = " + str(mag)) if mag != 0: uv = [a[0]/mag, a[1]/mag, a[2]/mag] print("Unit Vector = <" + str(uv[0]) + ", " + str(uv[1]) + ", " + str(uv[2]) + ">") def calc_dot_product(): a = get_vector_input("A") b = get_vector_input("B") dot_prod = (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) print("Dot Product = " + str(dot_prod)) def calc_cross_product(): a = get_vector_input("A") b = get_vector_input("B") x = (a[1]*b[2]) - (a[2]*b[1]) y = (a[2]*b[0]) - (a[0]*b[2]) z = (a[0]*b[1]) - (a[1]*b[0]) print("Cross Product = <" + str(x) + ", " + str(y) + ", " + str(z) + ">") def calc_cross_product_magnitude(): a = get_vector_input("A") b = get_vector_input("B") x = (a[1]*b[2]) - (a[2]*b[1]) y = (a[2]*b[0]) - (a[0]*b[2]) z = (a[0]*b[1]) - (a[1]*b[0]) mag = math.sqrt(x**2 + y**2 + z**2) print("Magnitude = " + str(mag)) def calc_angle_between(): a = get_vector_input("A") b = get_vector_input("B") dot = (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) mag_a = math.sqrt(a[0]**2 + a[1]**2 + a[2]**2) mag_b = math.sqrt(b[0]**2 + b[1]**2 + b[2]**2) if mag_a == 0 or mag_b == 0: print("Error: Zero vector") else: cos_t = dot / (mag_a * mag_b) if cos_t > 1.0: cos_t = 1.0 if cos_t < -1.0: cos_t = -1.0 rad = math.acos(cos_t) deg = math.degrees(rad) print("Radians = " + str(rad)) print("Degrees = " + str(deg)) def solve_quadratic(): print("ax^2+bx+c=0") try: a = float(input("a: ")) b = float(input("b: ")) c = float(input("c: ")) d = b**2 - 4*a*c if d >= 0: x1 = (-b + math.sqrt(d)) / (2*a) x2 = (-b - math.sqrt(d)) / (2*a) print("x1 = " + str(x1) + ", x2 = " + str(x2)) else: rp = -b / (2*a) ip = math.sqrt(-d) / (2*a) print("x1 = " + str(rp) + " + " + str(ip) + "i") print("x2 = " + str(rp) + " - " + str(ip) + "i") except ValueError: print("Error") while True: print("--- MENU ---") print("1. Magnitude") print("2. Dot Product") print("3. Cross Product") print("4. Cross Mag") print("5. Angle Between") print("6. Quadratic") print("7. Geometry") print("8. Exit") choice = input("Select: ") if choice == '1': calc_magnitude() elif choice == '2': calc_dot_product() elif choice == '3': calc_cross_product() elif choice == '4': calc_cross_product_magnitude() elif choice == '5': calc_angle_between() elif choice == '6': solve_quadratic() elif choice == '7': run_geometry_menu() elif choice == '8': break else: print("Invalid choice") input("Press Enter") Made with nCreator - tiplanet.org
>>
Compatible OS 3.0 et ultérieurs.
<<
import math def get_vector_input(vector_name): print("--- Vector " + vector_name + " ---") while True: try: x = float(input("Enter x: ")) y = float(input("Enter y: ")) z = float(input("Enter z: ")) return [x, y, z] except ValueError: print("Error: Numbers only.") def run_geometry_menu(): while True: print("--- GEOMETRY ---") print("1. Circle") print("2. Sphere") print("3. Cylinder") print("4. Back") choice = input("Select: ") if choice == '1': try: r = float(input("Radius: ")) area = math.pi * r**2 perimeter = 2 * math.pi * r print("Area = " + str(area)) print("Perimeter = " + str(perimeter)) except ValueError: print("Error") elif choice == '2': try: r = float(input("Radius: ")) # FIXED: Changed 4/3 to 4.0/3.0 to ensure correct decimal division. volume = (4.0/3.0) * math.pi * r**3 surface_area = 4 * math.pi * r**2 print("Volume = " + str(volume)) print("Surface Area = " + str(surface_area)) except ValueError: print("Error") elif choice == '3': try: r = float(input("Radius: ")) h = float(input("Height: ")) volume = math.pi * r**2 * h surface_area = (2*math.pi*r*h) + (2*math.pi*r**2) print("Volume = " + str(volume)) print("Surface Area = " + str(surface_area)) except ValueError: print("Error") elif choice == '4': break else: print("Invalid choice") input("Press Enter") def calc_magnitude(): a = get_vector_input("A") mag = math.sqrt(a[0]**2 + a[1]**2 + a[2]**2) print("Magnitude = " + str(mag)) if mag != 0: uv = [a[0]/mag, a[1]/mag, a[2]/mag] print("Unit Vector = <" + str(uv[0]) + ", " + str(uv[1]) + ", " + str(uv[2]) + ">") def calc_dot_product(): a = get_vector_input("A") b = get_vector_input("B") dot_prod = (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) print("Dot Product = " + str(dot_prod)) def calc_cross_product(): a = get_vector_input("A") b = get_vector_input("B") x = (a[1]*b[2]) - (a[2]*b[1]) y = (a[2]*b[0]) - (a[0]*b[2]) z = (a[0]*b[1]) - (a[1]*b[0]) print("Cross Product = <" + str(x) + ", " + str(y) + ", " + str(z) + ">") def calc_cross_product_magnitude(): a = get_vector_input("A") b = get_vector_input("B") x = (a[1]*b[2]) - (a[2]*b[1]) y = (a[2]*b[0]) - (a[0]*b[2]) z = (a[0]*b[1]) - (a[1]*b[0]) mag = math.sqrt(x**2 + y**2 + z**2) print("Magnitude = " + str(mag)) def calc_angle_between(): a = get_vector_input("A") b = get_vector_input("B") dot = (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) mag_a = math.sqrt(a[0]**2 + a[1]**2 + a[2]**2) mag_b = math.sqrt(b[0]**2 + b[1]**2 + b[2]**2) if mag_a == 0 or mag_b == 0: print("Error: Zero vector") else: cos_t = dot / (mag_a * mag_b) if cos_t > 1.0: cos_t = 1.0 if cos_t < -1.0: cos_t = -1.0 rad = math.acos(cos_t) deg = math.degrees(rad) print("Radians = " + str(rad)) print("Degrees = " + str(deg)) def solve_quadratic(): print("ax^2+bx+c=0") try: a = float(input("a: ")) b = float(input("b: ")) c = float(input("c: ")) d = b**2 - 4*a*c if d >= 0: x1 = (-b + math.sqrt(d)) / (2*a) x2 = (-b - math.sqrt(d)) / (2*a) print("x1 = " + str(x1) + ", x2 = " + str(x2)) else: rp = -b / (2*a) ip = math.sqrt(-d) / (2*a) print("x1 = " + str(rp) + " + " + str(ip) + "i") print("x2 = " + str(rp) + " - " + str(ip) + "i") except ValueError: print("Error") while True: print("--- MENU ---") print("1. Magnitude") print("2. Dot Product") print("3. Cross Product") print("4. Cross Mag") print("5. Angle Between") print("6. Quadratic") print("7. Geometry") print("8. Exit") choice = input("Select: ") if choice == '1': calc_magnitude() elif choice == '2': calc_dot_product() elif choice == '3': calc_cross_product() elif choice == '4': calc_cross_product_magnitude() elif choice == '5': calc_angle_between() elif choice == '6': solve_quadratic() elif choice == '7': run_geometry_menu() elif choice == '8': break else: print("Invalid choice") input("Press Enter") Made with nCreator - tiplanet.org
>>