Message Boards Message Boards

Find the x & y co-ordinates symbolically from slope & area?

Posted 8 years ago

Hi All,

Quick question. How can you find the x & y co-ordinates symbolically from having known slope & known area?

For example:- If we know the area from the right angle triangle = 1400. And the slope = 2/360*x.

then the answer is x = 720 & y = 4

But I am trying to setup a dynamic / Manipulate plot where I can adjust the slope. And as I change the slope the x & y coordinates change according to the new slope value whilst maintaining the triangle area of 1400. Therefore I was wondering if you could show me the coding to symbolically set this up.

DynamicModule[
 {m},
 Manipulate[Show[

   Plot[2/360*x, {x, 0, 1850}, Axes -> {True, True}, 
    PlotRange -> {{0, 1850}, {0, 16}}],
   Plot[m/360*x, {x, 0, 1850}, PlotStyle -> {Brown, Dashed}, 
    Axes -> {True, True}, PlotRange -> {{0, 1850}, {0, 16}}],

   ListPlot[{{{270, 1.5`}, {540, 3.`}, {810, 4.5`}, {1080, 
       6.`}, {1350, 7.5`}, {1620, 9.`}}, {{360, 2}, {720, 4}, {1080, 
       6}, {1440, 8}, {1800, 10}}}, PlotStyle -> {Red, Blue}, 
    Filling -> Axis],


   PlotLabel -> HoldForm["Plot of simple example AreaVsTime = degree"],
   LabelStyle -> {GrayLevel[0]}, ImageSize -> 600,
   GridLines -> {Table[i*360, {i, 10}], None},
   GridLinesStyle -> Directive[Purple, Dashed, Thin],
   Frame -> True, PlotRangePadding -> Scaled[0.02], 
   FrameTicks -> {{Table[i, {i, 0, 20, 2}], 
      Table[i, {i, 0, 15, 3}]}, {Table[i*360, {i, 10}], 
      Table[i*360, {i, 10}]}}, 
   FrameTicksStyle -> {{Blue, Red}, {Blue, Purple}},
   FrameStyle -> Directive[FontSize -> 7], 
   PerformanceGoal -> "Quality"]
  , {{m, 3, "Slope adjustment"}, 0.5, 10}]]

Many thanks for your help & attention. Best regards, Lea...

POSTED BY: Lea Rebanks
5 Replies
Posted 8 years ago

Hi Neil,

Many thanks for your excellent coding - really helpful & much appreciated.

Best regards, Lea...

POSTED BY: Lea Rebanks

Using Murray's post and turning it into a function you can get your graphic this way (if I am understanding what you want).

xyCoord[slope_, area_] := Module[{soln},
  soln = First@Solve[1/2 x*x*slope == area && x > 0, x];
  {x, 2/360 x} /. Last[soln]]

DynamicModule[{m, area, coords}, 
 Manipulate[coords = xyCoord[m/360, area]; 
  Show[Plot[2/360*x, {x, 0, 1850}, Axes -> {True, True}, 
    PlotRange -> {{0, 1850}, {0, 16}}], 
   Plot[m/360*x, {x, 0, 1850}, PlotStyle -> {Brown, Dashed}, 
    Axes -> {True, True}, PlotRange -> {{0, 1850}, {0, 16}}], 
   Graphics[Triangle[{{0, 0}, coords, {coords[[1]], 0}}]], 
   ListPlot[{{{270, 1.5`}, {540, 3.`}, {810, 4.5`}, {1080, 
       6.`}, {1350, 7.5`}, {1620, 9.`}}, {{360, 2}, {720, 4}, {1080, 
       6}, {1440, 8}, {1800, 10}}}, PlotStyle -> {Red, Blue}, 
    Filling -> Axis], 
   PlotLabel -> 
    HoldForm["Plot of simple example AreaVsTime = degree"], 
   LabelStyle -> {GrayLevel[0]}, ImageSize -> 600, 
   GridLines -> {Table[i*360, {i, 10}], None}, 
   GridLinesStyle -> Directive[Purple, Dashed, Thin], Frame -> True, 
   PlotRangePadding -> Scaled[0.02], 
   FrameTicks -> {{Table[i, {i, 0, 20, 2}], 
      Table[i, {i, 0, 15, 3}]}, {Table[i*360, {i, 10}], 
      Table[i*360, {i, 10}]}}, 
   FrameTicksStyle -> {{Blue, Red}, {Blue, Purple}}, 
   FrameStyle -> Directive[FontSize -> 7], 
   PerformanceGoal -> "Quality"], {{m, 3, "Slope adjustment"}, 0.5, 
   10, Appearance -> "Labeled"}, {{area, 1440, "area"}, 10, 1800, 
   Appearance -> "Labeled"}]]
POSTED BY: Neil Singer
Posted 8 years ago

Hi Murray,

Yes - sorry 1400 was a typo it should be 1440.

If you try the coding I sent within this discussion - you will see that by moving the slider in the Manipulate plot - causes the slope to change. I want to setup the coding so that area always remains at 1440 but the x & y coordinates change according to the new slope. Do you have any idea how I can set this up?

Many thanks for your help & attention. Lea...

POSTED BY: Lea Rebanks

Assuming it was a typo...

    a[m_][x_] := 1/2 x (m x)
    soln = First@Solve[a[2/360][x] == 1440 && x > 0, x];
    {x, 2/360 x} /. Last[soln]
(* {720, 4} *}

Readily generalizable, e.g., for lines not passing through origin, for areas not from 0 to x but from some fixed a to x, and even for some non-linear functions.

POSTED BY: Murray Eisenberg

I don't understand your numerical example. If the triangle's base is x = 720 and its height is y = 4, then its area would be (x y)/2 = (720*4)/2 = 1440, not 1400. So was that a typo?

POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract