Trig Help: Measuring Length & Coordinates on a Unit Square Grid

In summary, the individual is working on a personal project involving a 2x2 grid and is trying to find the length and coordinates of an arrow/line on the grid. They are struggling with writing a function to do this for all angles and are looking for a more efficient solution. They have been using trigonometry and the right angle to find the distance, but are wondering if there are other tools available to help them solve this problem. Another individual suggests using the expression sec[{(1-2*floor[(x%90)/45])*x}%90] as a solution.
  • #1
JazzMasterKC
19
0
0. The app does not have the template built in so ill do my best, sorry i don't have a computer right now.

1. This is a personal project, and there is a lot to it but I'm cutting out down to where i need help.

Imagine a 2x2 grid of squares (2d for now). The center vector is at (0,0), and the length of one side of a square is 1m (or just think of one, distance doesn't matter right now). So essentially the grid is 2m by 2m. Now a arrow/line is abstract so it can help us meassure the distance from the center to a point on the outer rim of the grid.. in otherwords think of this like the unit circle (trig) but in a square... This is actually the direction where an object will be projected but that's unrelated to my question.

2. So what i wanted was to obtain that length of arrow/line and actually the cordinates on the grid.. i can figure that out easily because I am given the angle of the arrow.. and yes so if the arrow is at the cordinate (0,1) that is a 90 degree angle. I can use a triangle for reference but since its a square i can't seem to figure out how to write a function that can pull this off from 0 degrees to 360.. every 45 degrees i have to switch which function it will use.. and I been using the tool of sin(A)/a=sin(B)/b.. as well as soh-cah-toa because i use the right angle to help me find the distance of the arrow.

3. So my question is how can i make this into one function rather then 8 different ones that switch after x amount of degrees. This is also a computer program so id like to keep it optimal.. my math course is entering calc 1 this fall so pre-calc.. I wonder if I'm not seeing something or is there other tools avaliable to help me figure this out?

Thanks
 
Physics news on Phys.org
  • #2
This should return the length for any angle:

sec[{(1-2*floor[(x%90)/45])*x}%90],

where x is your angle in degrees, % is the modulus function, floor returns the next lowest integer, and sec is the secant function.

I would have a hard time explaining this without drawing a picture, but here goes... The distance to the edge of the unit square can always be expressed as 1/cos(q)=sec(q), where q is an angle between 0 and 45. This value should rise from 0-45 as x goes from 0-45, fall from 45-0 as x goes from 45-90, and so on. Can you see this? A picture would help. Anyway, the expression (1-2*floor[(x%90)/45]) is equal to 1 when x is from 0-45, 90-135, etc. and equal to -1 when x is from 45-90, 135-180, etc. Then {(1-2*floor[(x%90)/45])*x}%90 ends up creating the required graph for q.
 
Last edited:
  • #3
Wow good idea thanks a lot!
 

1. What is a unit square?

A unit square is a square with sides that measure exactly 1 unit in length. It is typically used in mathematics to represent a square with a total area of 1 square unit.

2. How is trigonometry related to a unit square?

Trigonometry is a branch of mathematics that deals with the relationships between the sides and angles of triangles. In a unit square, the sides and angles can be used to represent trigonometric functions such as sine, cosine, and tangent.

3. What is the Pythagorean theorem and how does it relate to a unit square?

The Pythagorean theorem states that in a right triangle, the square of the length of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides. In a unit square, this can be represented by the equation a^2 + b^2 = c^2, where a and b are the sides of the square and c is the hypotenuse.

4. How can a unit square be used to find trigonometric ratios?

A unit square can be used to find trigonometric ratios by dividing the sides of the square into smaller triangles and using the Pythagorean theorem to find the lengths of the sides. The ratios of these side lengths can then be used to calculate the values of trigonometric functions.

5. Are there any real-world applications of using a unit square in trigonometry?

Yes, there are many real-world applications of using a unit square in trigonometry. For example, it can be used to calculate the height of a building or the distance between two points on a map using angles and distances. It is also used in navigation and engineering to calculate the position and movement of objects.

Similar threads

  • Linear and Abstract Algebra
Replies
9
Views
216
  • Classical Physics
Replies
7
Views
867
  • Atomic and Condensed Matter
Replies
3
Views
92
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Replies
11
Views
3K
  • Precalculus Mathematics Homework Help
Replies
10
Views
1K
Replies
1
Views
801
  • Advanced Physics Homework Help
Replies
7
Views
1K
  • STEM Academic Advising
Replies
2
Views
1K
Back
Top