(*  A Mathematic Program for simulating a one-legged jumping creature *)
(* Power to run   *)
                 

PowerRun1 = (((1+γ)*M*(g^2)*L*β*j)/(8*V))+((m*(V^3))/(2*L*β*(1+j)));

(*    we will set leg length to be a which is approx L*β *)
PowerRun = (((1+γ)*M*(g^2)*a*j)/(8*V))+((m*(V^3))/(2*a*(1+j)));
Parameters = {a -> 0.4, V -> 4, M -> 20, m -> 1, γ -> 0,g-> 9.8};
Plot[PowerRun /. Parameters, {j,0,5}, PlotRange -> {0,150},
   PlotStyle -> {Blue,Thick},LabelStyle->{Blue,Bold},AxesLabel->{"Jumpiness","Power (Watts)"}]

Parameters = {a -> 0.3, M -> 20, m -> 1,γ -> 0, g -> 9.8};
ContourPlot[(PowerRun /.Parameters ),{j,0,5},{V,0,6}, ColorFunction -> "BlueGreenYellow"]

Manipulate[Plot[((((1+γ)*M*(g^2)*a*j)/(8*V))+((m*(V^3))/(2*a*(1+j)))),{j,0,5}, PlotRange->{0,1},PlotStyle -> {Blue,Thick},AxesLabel->{"j","Power"}],{{M,20},10,100},{{m,1},0.5,10},{{g,9.8},2,30},{{a,0.4},0.1,1},{{γ,0},-1,1},{{V,4},.1,10}]

Manipulate[Plot3D[(((1+γ)*M*(g^2)*a*j)/(8*V))+((m*(V^3))/(2*a*(1+j))),{j,0,5},{V,1,5}, PlotRange->{0,300},PlotStyle -> {Blue,Thick},ColorFunction-> "BlueGreenYellow"],{{M,20},10,100},{{m,1},0.5,10},{{g,9.8},2,30},{{a,0.4},0.1,1},{{γ,0},-1,1}]

dPowerdj = D[PowerToRun,j]

jopt = Solve[dPowerdj == 0, j]

Bestjever = j /. jopt[[2,1]]