I have an API that I am working on but its not working. The function is supposed to solve this exercise:
25*(II) A car at the Indianapolis 500 accelerates uniformly from the pit area, going from rest to 270 km/h in a semicircular arc with a radius of 220 m. Determine the tangential and radial acceleration of the car when it is halfway through the arc, assuming constant tangential acceleration. If the curve were flat, what coefficient of static friction would be necessary between the tires and the road to provide this acceleration with no slipping or skidding?
I used the symbolic solution to program this API function.
func = APIFunction[{"radius" ->
Restricted["ComputedQuantity",
"Meters", {Quantity[54, "Meters"], Quantity[403, "Meters"]}],
"$starting$speed" ->
Restricted["ComputedQuantity",
"Meters" ("Seconds")^-1, {Quantity[0, ("Meters")/("Seconds")],
Quantity[54, ("Meters")/("Seconds")]}],
"$ending$speed" ->
Restricted["ComputedQuantity",
"Meters" ("Seconds")^-1, {Quantity[60, ("Meters")/("Seconds")],
Quantity[148, ("Meters")/("Seconds")]}],
"$gravitational$acceleration" ->
Restricted["ComputedQuantity",
"Meters" ("Seconds")^-2, {Quantity[1, ("Meters")/("Seconds")^2],
Quantity[148, ("Meters")/("Seconds")^2]}]}, {QuantityVariable[
"\[Mu]","StaticFrictionCoefficient"] ->
Sqrt[(#$ending$speed^2/(2 \[Pi] #radius) - #$starting$speed^2/(
2 \[Pi] #radius))^2 + (#$starting$speed^2 + \[Pi] #radius \
(#$ending$speed^2/(2 \[Pi] #radius) - #$starting$speed^2/(
2 \[Pi] #radius)))^2/#radius^2]/#$gravitational$\
acceleration,
QuantityVariable["a","Acceleration"] ->
Sqrt[(#$ending$speed^2/(2 \[Pi] #radius) - #$starting$speed^2/(
2 \[Pi] #radius))^2 + (#$starting$speed^2 + \[Pi] #radius \
(#$ending$speed^2/(2 \[Pi] #radius) - #$starting$speed^2/(
2 \[Pi] #radius)))^2/#radius^2], QuantityVariable[
\!\(\*SubscriptBox[\("a"\), \("c"\)]\),
"CentripetalAcceleration"] -> (#$starting$speed^2 +
1/2 \[Pi] #radius (#$ending$speed^2/(\[Pi] #radius) - \
#$starting$speed^2/(\[Pi] #radius)))/#radius, QuantityVariable[
\!\(\*SubscriptBox[\("v"\), \("Q"\)]\),"Velocity"] ->
Sqrt[#$starting$speed^2 +
1/2 \[Pi] #radius (#$ending$speed^2/(\[Pi] #radius) - \
#$starting$speed^2/(\[Pi] #radius))], QuantityVariable[
\!\(\*SubscriptBox[\("a"\), \("tan"\)]\),
"TangentialAcceleration"] -> #$ending$speed^2/(
2 \[Pi] #radius) - #$starting$speed^2/(2 \[Pi] #radius)} &];
Here's an example
func[<|"radius" -> Quantity[220, "Meters"],
"$starting$speed" -> Quantity[0, ("Kilometers")/("Hours")],
"$ending$speed" -> Quantity[270, ("Kilometers")/("Hours")],
"$gravitational$acceleration" ->
Quantity[1, "StandardAccelerationOfGravity"]|>] // N
and the output
{QuantityVariable["\[Mu]","StaticFrictionCoefficient"] ->
1.36806323253,
QuantityVariable["a","Acceleration"] ->
Quantity[13.4161172993, ("Meters")/("Seconds")^2],
QuantityVariable[
\!\(\*SubscriptBox[\("a"\), \("c"\)]\),"CentripetalAcceleration"] ->
Quantity[12.7840909091, ("Meters")/("Seconds")^2],
QuantityVariable[
\!\(\*SubscriptBox[\("v"\), \("Q"\)]\),"Velocity"] ->
Quantity[53.033008589, ("Meters")/("Seconds")], QuantityVariable[
\!\(\*SubscriptBox[\("a"\), \("tan"\)]\),"TangentialAcceleration"] ->
Quantity[4.06930252224, ("Meters")/("Seconds")^2]}
I have a deployment in the cloud:
API = CloudDeploy[func,
"Giancoli Physics Principles with Applications Chapter 5 Exercise \
25 function", Permissions -> "Public"]
I'm not sure how to execute a query like func[<|key->value|>] above. I tried
URLExecute[API,
URLEncode[<|"radius" -> Quantity[289, "Meters"],
"$starting$speed" -> Quantity[7, ("Kilometers")/("Hours")],
"$ending$speed" -> Quantity[324, ("Kilometers")/("Hours")],
"$gravitational$acceleration" ->
Quantity[1, "StandardAccelerationOfGravity"]|>]]
but I got a failure
Failure["ConnectionFailure", <|"MessageTemplate" :> MessageName[
URLExecute, "iurl"], "MessageParameters" -> {
CloudObject[
"https://www.wolframcloud.com/obj/burbery1/Giancoli Physics \
Principles with Applications Chapter 5 Exercise 25 function"]},
"URL" -> CloudObject[
"https://www.wolframcloud.com/obj/burbery1/Giancoli Physics \
Principles with Applications Chapter 5 Exercise 25 function"],
"HTTPRequest" -> HTTPRequest[
CloudObject[
"https://www.wolframcloud.com/obj/burbery1/Giancoli Physics \
Principles with Applications Chapter 5 Exercise 25 function"], <||>],
"Counter" -> 1|>]
I think the solution might be similar to a weather function I made:
URLExecute[
HTTPRequest[
CloudObject[
"https://www.wolframcloud.com/obj/17846929-623c-4a7a-8172-\
9837ec51a19d"], <|"Query" -> {"city" -> "NYC"}|>]]