Message Boards Message Boards

0
|
3501 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to find the interval where the root exists?

I've got a program which plots 2 graphs(Sin[x] and Log[y]) and 2 lists of rectangles(built from lists of numbers spx,spy) in accordance. Prompt, please, how to get the interval (or even the rectangle) andwhere these rectangles overlap?

spx = {-1, -0.75, -0.5 , -0.35, -0.25 , 0, 0.3, 0.775 , 0.95 , 1.55 , 
   1.6, 2.325 , 2.375 , 3.1, 3.825, 3.925, 4.55 , 4.7, 5.275 , 5.35, 
   5.675 , 6};
spy = {1, 2.25, 3.5, 4.75, 6}
g1 = Graphics[{EdgeForm[{Black, Thick}], {Pink, Opacity[0.7], 
     Table[Rectangle[{spx[[i]], 
        Sin[spx[[i]]] + Cos[spx[[i]]]}, {spx[[i + 1]], 
        Sin[spx[[i + 1]]] + Cos[spx[[i + 1]]]}], {i, 1, 
       Length[spx] - 1}]}}, Axes -> True];
g2 = Plot[{Sin[x]}, {x, -1, 6}, PlotStyle -> Thick];
g3 = Graphics[{EdgeForm[{Black, Thick}], {Yellow, Opacity[0.7], 
     Table[Rectangle[{spy[[i]], Log[spy[[i]]]}, {spy[[i + 1]], 
        Log[spy[[i + 1]]]}], {i, 1, Length[spy] - 1}]}}, Axes -> True];
g4 = Plot[{Log[y]}, {y, 1, 6}, PlotStyle -> Thick];
lift = {{x_Real, y_Real} :> {z, y, x}, Rectangle :> Cuboid};
lifted1 = N[g1] /. lift;
lifted2 = N[g2] /. lift;
lifted3 = N[g3] /. lift;
lifted4 = N[g4] /. lift;

zlevelI = 0;
zlevel[] := (zlevelI = zlevelI + .001);

Show[Graphics3D @@ (lifted1 /. z :> 0), 
 Graphics3D @@ (lifted2 /. z :> 1 + zlevel[]), 
 Graphics3D @@ (lifted3 /. z :> 0), 
 Graphics3D @@ (lifted4 /. z :> 1 + zlevel[])]![enter image description here][1]
POSTED BY: Julia Ilkiv
3 Replies
Posted 9 years ago

Since you appear to have enough information to find the upper left and lower right corners of each rectangle, consider:

For each rectangle r1 on the log curve
   For each rectangle r2 on the Sin curve
      Is the upper left corner of r1 between the upper left and lower right corners of r2
      Is the lower right corner of r1 between the upper left and lower right corners of r2
      Is the upper left corner of r2 between the upper left and lower right corners of r1
      Is the lower right corner of r2 between the upper left and lower right corners of r1

With some thinking you might be able to determine why I posed the problem this way. That is probably the essential skill they are really trying to get you to learn. Then you need to figure out little details like what "between" means and how you might determine that from the information that you have and how to do this with all pairs of rectangles. Then you might figure out why I asked all four of those questions, instead of just one or two, and how together those might get the answer that you need.

POSTED BY: Bill Simpson

oh,it was a mechanical error) Thanks, but I need an interval or coordinates of rectangle, where these rectangles overlap. how to find it? out

POSTED BY: Julia Ilkiv

It appears you use Log[y] rather than Cos[y]? Anyway, intersection points can be found with Solve.

Solve[Sin[x] == Log[x] && -1 <= x <= 6, x]

(* Out[75]= {{x -> 
   Root[{Log[#1] - 2 Tan[#1/2] + Log[#1] Tan[#1/2]^2 &,  2.2191071489137460325958}]}} *)
POSTED BY: Daniel Lichtblau
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