Thuwarakesh commited on
Commit
ba733b0
·
1 Parent(s): eeb6d88

create mcp

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+
3
+ import gradio as gr
4
+
5
+
6
+ def compute_projectile_distance(initial_speed, angle):
7
+ """
8
+ Calculate the horizontal distance traveled by a projectile.
9
+
10
+ Parameters:
11
+ initial_speed (float): Initial speed of the projectile in m/s
12
+ angle (float): Launch angle in degrees
13
+
14
+ Returns:
15
+ float: Horizontal distance traveled in meters
16
+ """
17
+ # Convert angle from degrees to radians
18
+ angle_rad = math.radians(angle)
19
+
20
+ # Gravitational acceleration (m/s²)
21
+ g = 9.81
22
+
23
+ # Calculate the horizontal distance using the projectile motion formula:
24
+ # distance = (initial_speed² * sin(2*angle)) / g
25
+ distance = (initial_speed**2 * math.sin(2 * angle_rad)) / g
26
+
27
+ return distance
28
+
29
+
30
+ app = gr.Interface(
31
+ fn=compute_projectile_distance,
32
+ inputs=["number", "number"],
33
+ outputs="number",
34
+ title="Compute Projectile Distance",
35
+ description="Computes the theoretical horizontal distance a projectile travels for a given initial speed and angle.",
36
+ )
37
+
38
+ app.launch(mcp_server=True)