Permalink
Browse files

PSE 5E Example 4.7

  • Loading branch information...
1 parent 99ffb6e commit c51408c18b0a6fc95de2fb7ec042f38610349ea0 @dharmatech committed Mar 9, 2013
View
71 PSE 5E Example 4.7 The End of the Ski Jump/PSE 5E Example 4.7 The End of the Ski Jump.csproj
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9749F6B7-833F-4545-A69B-F6ED9DDEBB15}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>PSE_5E_Example_4._7_The_End_of_the_Ski_Jump</RootNamespace>
+ <AssemblyName>PSE 5E Example 4.7 The End of the Ski Jump</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Physics\Physics.csproj">
+ <Project>{73E0C26D-5333-4575-A3E9-5388E975446E}</Project>
+ <Name>Physics</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Symbolism\Symbolism.csproj">
+ <Project>{067278C5-2A0F-42DE-838B-855EFB652608}</Project>
+ <Name>Symbolism</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Utils\Utils.csproj">
+ <Project>{A3F0F5DB-7EB2-488F-B79C-F667C4E5AB02}</Project>
+ <Name>Utils</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
131 PSE 5E Example 4.7 The End of the Ski Jump/Program.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Symbolism;
+using Physics;
+using Utils;
+
+namespace PSE_5E_Example_4._7_The_End_of_the_Ski_Jump
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ // A ski jumper leaves the ski track moving in the horizontal
+ // direction with a speed of 25.0 m/s, as shown in Figure 4.14.
+ // The landing incline below him falls off with a slope of 35.0°.
+ // Where does he land on the incline?
+
+ var thA = new Symbol("thA"); // angle at point A
+ var vA = new Symbol("vA"); // velocity at point A
+
+ var g = new Symbol("g"); // magnitude of gravity
+
+ var _g = new Point(0, -g); // gravity vector
+
+ var objA = new Obj()
+ {
+ position = new Point(0, 0),
+ velocity = Point.FromAngle(thA, vA),
+ acceleration = _g,
+ time = 0
+ };
+
+ var th = new Symbol("th"); // angle of incline
+
+ var intersection = objA.ProjectileInclineIntersection(th);
+
+ Action nl = () => "".Disp();
+
+ "Where does he land on the incline?".Disp();
+
+ "".Disp();
+
+ "x position (symbolic):".Disp();
+
+ intersection.x.Disp(); nl();
+
+ "y position (symbolic):".Disp();
+
+ intersection.y.Disp(); nl();
+
+ "x position (numeric):".Disp();
+
+ intersection.x
+ .Substitute(vA, 25)
+ .Substitute(thA, 0.0)
+ .Substitute(th, (-35).ToRadians())
+ .Substitute(Trig.Pi, 3.14159)
+ .Substitute(g, 9.8)
+ .Disp();
+
+ nl();
+
+ "y position (numeric):".Disp();
+
+ intersection.y
+ .Substitute(vA, 25)
+ .Substitute(thA, 0.0)
+ .Substitute(th, (-35).ToRadians())
+ .Substitute(Trig.Pi, 3.14159)
+ .Substitute(g, 9.8)
+ .Disp();
+
+ nl();
+
+ var objB = new Obj()
+ {
+ position = intersection,
+ acceleration = _g
+ };
+
+ "Determine how long the jumper is airborne".Disp();
+
+ nl();
+
+ "symbolic:".Disp();
+
+ var timeB = Calc.Time(objA, objB, 1);
+
+ timeB.Disp();
+
+ nl();
+
+ "numeric:".Disp();
+
+ timeB
+ .Substitute(vA, 25)
+ .Substitute(thA, 0.0)
+ .Substitute(th, (-35).ToRadians())
+ .Substitute(Trig.Pi, 3.14159)
+ .Substitute(g, 9.8)
+ .Disp();
+
+ nl();
+
+ objB = objA.AtTime(timeB);
+
+ "Determine his vertical component of velocity just before he lands".Disp();
+
+ nl();
+
+ "symbolic:".Disp();
+
+ objB.velocity.y.Disp(); nl();
+
+ "numeric:".Disp();
+
+ objB.velocity.y
+ .Substitute(vA, 25)
+ .Substitute(thA, 0.0)
+ .Substitute(th, (-35).ToRadians())
+ .Substitute(Trig.Pi, 3.14159)
+ .Substitute(g, 9.8)
+ .Disp();
+
+ Console.ReadLine();
+ }
+ }
+}
View
36 PSE 5E Example 4.7 The End of the Ski Jump/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PSE 5E Example 4.7 The End of the Ski Jump")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PSE 5E Example 4.7 The End of the Ski Jump")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("74c59fef-86cd-4252-b064-bd627f9bf846")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
83 Physics/Physics.cs
@@ -121,6 +121,89 @@ public Obj AtTime(MathObject t)
position = position + velocity * dt + acceleration * dt * dt / new Integer(2)
};
}
+
+
+ #region ProjectileInclineIntersection derivation
+
+ // xB = xA + vAx t + 1/2 ax t^2 (9)
+
+ // yB = yA + vAy t + 1/2 ay t^2 (10)
+
+ // xB - xA = d cos th (13)
+
+ // yB - yA = d sin th (14)
+
+ // ax = 0 (11)
+
+ // vAx = vA cos(thA) (6)
+
+ // vAy = vA sin(thA) (7)
+
+
+ // (9): xB = xA + vAx t + 1/2 ax t^2
+
+ // xB - xA = vAx t + 1/2 ax t^2 (9.1)
+
+ // (10): yB = yA + vAy t + 1/2 ay t^2
+
+ // yB - yA = vAy t + 1/2 ay t^2 (10.1)
+
+
+ // (13): xB - xA = d cos th
+
+ // /. (9.1) vAx t + 1/2 ax t^2 = d cos th
+
+ // /. (11) vAx t = d cos th
+
+ // t t = d cos(th) / vAx (13.1)
+
+
+ // (14): yB - yA = d sin th
+
+ // /. (10.1) vAy t + 1/2 ay t^2 = d sin th
+
+ // /. (13.1) vAy [d cos(th) / vAx] + 1/2 ay [d cos(th) / vAx]^2 = d sin th
+
+ // vAy / vAx d cos(th) + 1/2 ay [d cos(th) / vAx]^2 = d sin th
+
+ // 1/2 ay [d cos(th) / vAx]^2 = d sin th - vAy / vAx d cos(th)
+
+ // 1/2 ay [d cos(th) / vAx]^2 = d [sin(th) - vAy / vAx cos(th)]
+
+ // 1/2 ay d^2 [cos(th) / vAx]^2 = d [sin(th) - vAy / vAx cos(th)]
+
+ // 1/2 ay d [cos(th) / vAx]^2 = [sin(th) - vAy / vAx cos(th)]
+
+ // d = 2 [sin(th) - vAy / vAx cos(th)] [vAx / cos(th)]^2 / ay
+
+ // if vAy = 0 then it simplifies to:
+
+ // d = 2 sin(th) [vAx / cos(th)]^2 / ay
+
+ #endregion
+
+ public Point ProjectileInclineIntersection(MathObject theta)
+ {
+ if (theta != null &&
+ velocity.x != null &&
+ velocity.y != null &&
+ acceleration.y != null &&
+ acceleration.y != 0 &&
+ acceleration.y != 0.0)
+ {
+ var d =
+ 2 * (Trig.Sin(theta) - velocity.y / velocity.x * Trig.Cos(theta))
+ * ((velocity.x / Trig.Cos(theta)) ^ 2)
+ / acceleration.y;
+
+ return
+ new Point(
+ position.x + d * Trig.Cos(theta),
+ position.y + d * Trig.Sin(theta));
+ }
+
+ throw new Exception();
+ }
}
public static class Calc
View
12 Symbolism.sln
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSE 5E Example 4.5 Thats Qu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils.csproj", "{A3F0F5DB-7EB2-488F-B79C-F667C4E5AB02}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSE 5E Example 4.7 The End of the Ski Jump", "PSE 5E Example 4.7 The End of the Ski Jump\PSE 5E Example 4.7 The End of the Ski Jump.csproj", "{9749F6B7-833F-4545-A69B-F6ED9DDEBB15}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -83,6 +85,16 @@ Global
{A3F0F5DB-7EB2-488F-B79C-F667C4E5AB02}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A3F0F5DB-7EB2-488F-B79C-F667C4E5AB02}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A3F0F5DB-7EB2-488F-B79C-F667C4E5AB02}.Release|x86.ActiveCfg = Release|Any CPU
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Debug|x86.ActiveCfg = Debug|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Debug|x86.Build.0 = Debug|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Release|Any CPU.ActiveCfg = Release|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Release|Mixed Platforms.Build.0 = Release|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Release|x86.ActiveCfg = Release|x86
+ {9749F6B7-833F-4545-A69B-F6ED9DDEBB15}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
7 Tests/Tests.cs
@@ -319,6 +319,13 @@ static void Main(string[] args)
}
#endregion
+ //{
+ // var th = (-35).ToRadians();
+
+ // (2 * Trig.Sin(th) * ((25 / Trig.Cos(th)) ^ 2) / -9.8)
+ // .Substitute(Trig.Pi, 3.14159)
+ // .Disp();
+ //}
Console.WriteLine("Testing complete");

0 comments on commit c51408c

Please sign in to comment.