cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Intersections Calculate 2 circles / Analysis / Math

Marc2610
10-Marble

Intersections Calculate 2 circles / Analysis / Math

Hey,

I am from Germany and need some help. I am new with MathCad.

 

I want to calculate the insections of 2 cycles.

 

My Problems:

 

The plot of 2 variables in 1 diagram doesnt work. I tried it on the x-Axis with f(x,y) and on the y axis with x,y. No cycle is shown.

 

Then next problem is to subtract f(x,y) - g(x,y). Whats the Syntax? Can somebody tell me?

 

Is it possible to write a litte programm which calculates me the intersections or tell me the solution?

My program:


m11:=0
m12:=0
r1=8

m21:=7
m22:=8
r2:=3.25


f(x,y):=(x-m11)^2 + (y-m12)^2 - r1^2
g(x,y):=(x-m21)^2 + (y-m22)^2 - r2^2


h(x,y):=f(x,y)-g(x,y)


Thank you.

 

Greetings MM

ACCEPTED SOLUTION

Accepted Solutions

Here is one way (done in Prime 2, so there is no point in providing the worksheet!)

 

circles.JPG

 

Alan

View solution in original post

22 REPLIES 22

Here is one way (done in Prime 2, so there is no point in providing the worksheet!)

 

circles.JPG

 

Alan

Werner_E
25-Diamond I
(To:Marc2610)

First of all: Don't just post pictures, post the Mathcad or Prime worksheet!

 

Its not clear if you just want to plot two circles or if you want to calculate the points of intersection.

 

What you defined with f(x,y):=... ist NOT a circle! Its a surface in 3D, a paraboloid. To plot it you would have to use Primes mediocre 3D-plot capabilities.

 

The circle you probably have in mind has the equation f(x,y)=0 and is the intersection of the paraboloid with the xy-plane.

 

To plot the circle you cant use the equation you created, because Prime unfortunately does not support implicit plots. You may solve f(x,y)=0 for y and plot each of the two solutions in one plot (upper and lower half of the circle) or you define the whole circle using a parameter representation.

 

To calculate the points of intersection of f(x,y)=0 with g(x,y)=0 you may either use the symbolic solve command or a numeric solve block.

 

See if the attached worksheet helps.

Thanks so much for your solutions,

i will try to understand the sheets, but this will take me some time.

 

@Werner_E i think you are from germany, it will be nice if you can give me some tipps in german in further times 🙂

 

To understand this calculation its better to plot the circles and then to calculate it 🙂

 

So i will post the worksheet here, but i think its not correct.

 

Greetings

Marc 🙂

 

 

Thanks so much for your solutions,

i will try to understand the sheets, but this will take me some time.

 

@Werner_E i think you are from germany, it will be nice if you can give me some tipps in german in further times 🙂

 

To understand this calculation its better to plot the circles and then to calculate it 🙂

 

So i will post the worksheet here, but i think its not correct.

 

Greetings

Marc 🙂

 

 

I cant understand if i calculate it on paper i can calculate with (x-m1)^2+(y-m2)^2=r^2.

 

why i cant do the same with mathcad?

 

 

Werner_E
25-Diamond I
(To:Marc2610)


@Marc2610 wrote:

I cant understand if i calculate it on paper i can calculate with (x-m1)^2+(y-m2)^2=r^2.

 

why i cant do the same with mathcad?

 

 


Why do you think you can't?

You can use the very same equation for calculations in Mathcad.

 

You simply can't PLOT a function given implicitly. Thats something Mathcad unfortunately is not capable of.

 

To use the equation you cited you have to use the Boolean equal sign (the fat 😃 and not the assignment equal (:=) or the numeric evaluation equal sign (=).

Usually you get the Boolean equal sign by pressing Ctrl and + at the same time. The help says to press  Ctrl and = but that may only be true if you are using an English keyboard layout, not if you are using a German one.

 

Hey,

is it possible to upload the file @AlanStevens Alan? 

i have problems to create the mathcad file.

 

I dont understand the solverblock and the theta with index, the deg isnt in blue colour, and mathcad have problems with "i".


@Marc2610 wrote:

I dont understand the solverblock and the theta with index, the deg isnt in blue colour, and mathcad have problems with "i".


Alan has defined i as a range variable (from 0 to 360 in steps of 1.)  He then defines theta as a vector of angles from 0 degrees to 360 degrees.  (You need to be sure that the deg in that definition is labeled as a unit.)  As Werner explained, to plot the entire circle you need to plot with theta as the parameter.

 

The solve block finds the values of x where the values of y are the same.  (Alan deals with numerical errors by making the difference very small rather than trying for exact equality.)

 

Is it possible to calculate the x and y easier?

I prefer the way i did by hand (uploaded picture)

 

The best way for me is to create variables for the middle of the cycles and the radius of both cycles.

 

Then i want to subtract the 2 equations, plot the 2 cycles, plot the 2 intersections, get the intersection variables x and y like this:

x1=

x2=

y1=

y2=

 

 

Werner_E
25-Diamond I
(To:Marc2610)

Look if the attached helps.

BTW, the error you get is because you have to use the vector index when you type theta[i, not the literal index you get with theta [ctrl -] i.

 

 

Thanks, this is what i need, but now i dont understand were is the calculation on the sheet (equation f(x,y)....)?

 

Is it possible to get the x1/y1 and x2/y2 koordinates as a variable? Read it out of the matrix?

 

i have to calculate with this values in later calculations.

 

The reason, why i want to calculate this is, i have a hydraulic zylinder. This zylinder lifts a crucible. i need to know at which stroke in mm the corner of the crucible is in degrees.

 

so i need the x koordinates, and subract the x-value of the upper cycle from the x koordinate. then i can calculate with the corner functions the degree of the crucible.

 

is it possible to get a matrix or something else, to get a list with values for each millimeter for the stroke (0-440mm)?

 

oh,

i found the calculation 🙂 i have to click the "+". I dont understand the first calculation. I think i have to study math for this, mechanical engineering isnt enough to understand this :-(.

Werner_E
25-Diamond I
(To:Marc2610)

No need to study math.

kreis() simply creates a m N-sided polygon to approximate a circle and is only used for plotting.

It creates a (N+1) x 2 matrix with the coordinates of the points. first column x-coordinates, second column y-coordinates.

Its a utility routine you can use if you intend to plot a couple of circles and don't want to bother with any kind of equations.

 

Concerning the matrix you are looking for or the angle - I am pretty sure Mathcad can deliver what you need, but unfortunately I don't understand which values you would need. Not sure where the 440mm you mention do stem from.

 

When it comes to the coordinated of the points of intersection, you may either access them as matrix elements using matrix indices and of course you may also assign the values to dedicated variables, too.
See attached sheet.

Werner_E
25-Diamond I
(To:Marc2610)

Reply to your PM below:

According to you handwritten notes in a former answer it looks like not the larger circle is your cylinder but your cylinder rather is a radius of that circle and the smaller circle is not the lever but rather the path of its end.

It looks to me like your are only interested in the upper left one of the two points of intersection, right? The one with the lower x-coordinate.

As the lever and the cylinder are connected, the cylinder must have a minimal length of about 7,38. Otherwise the two circles will not intersect.

So I wonder why you are talking of a range from 4 to 8?

See if the attachment is of help

 

 

---- snipp --------------------------------

ich versuche es hier mal auf deutsch, da englisch nicht so meine Sprache ist 🙂

 

Ich brauche im Endeffekt eine Tabelle, wo ich abhängig vom Hub des Zylinders (Zylinder ist der unter Kreis (0/0)einen den Winkel des Hebels errechnen kann (Hebel ist der obere Kreis), vllt kann man das auf dem Foto mit meinen händsichen Berechnungen erkennen.

 

Wenn ich den x Wert zum Hebel kenne, welcher constant ist (in dem Beispiel der Wert x = 7), dann kann ich mir den Winkel errechnen, dadruch, dass ich die 7 minus meinem x wert der koorinate nehme. dann bekomme ich eine seite des dreieckes, der Hebel ist immer konstant (3,25= Hypotenuse).

 

Ich denke auf dem Bild kann man die Problemstellung erkennen, ansonsten kann ich gerne eine Skizze machen.

 

Der Zylinder hat eine Länge von, sagen wir mal 8, dies ist der Radius = 8, ausgefahren. Fahre ich den Zylinder ein, dann hat er z.B. eine Länge von 4. somit brauch ich am besten eine Tabelle, die die Winkel von 4,01, 4,02.... bis 8,00 ausspuckt.

Hey, thanks for your new version, it is getting more complicated, but this is what i need. The r_start is 1108 and the r_end is 1548. The calculation of the lever angle begins at r_start (zylinder lenght) = 1108, (in my CAD-Modell the angle then is approximately 14.6 degrees. I have to confess, that i dont fully grasp this sheet, i thought that the calculation is easier. 😞

 

yes the larger cycle is the Zylinder, i posted a sketch with the real values. the values of 4+4 and 3.25 are values which makes it for me easy to check my calculation and to ensure my way is the correct one.

 

Yes you are right i am only interestet in the left (lower x) intersection and the x-value of it. The max value of zylinder is 1108mm+440mm.

 

Marc

Werner_E
25-Diamond I
(To:Marc2610)

There might possibly be shorter approaches to your task but I don't consider the sheet complex or complicated (you can completely delete the first page) and it should work with the real values you have as well, I hope.

Hey,

so, i got the solution for my problem.

Now i have to implement a table where the values from 0 to 440 are shown.

 

@Werner_E can you tell me, what you did on top of the sheet kreis(xm,ym,r):=.......  ?

 

Thanks for help.

 

Marc

Werner_E
25-Diamond I
(To:Marc2610)


@Marc2610 wrote:

Hey,

so, i got the solution for my problem.

Now i have to implement a table where the values from 0 to 440 are shown.

 

@Werner_E can you tell me, what you did on top of the sheet kreis(xm,ym,r):=.......  ?

 

I think I explained that shortly in an answer above or in my PM.

"kreis" is a function which takes the coordinates of the venter of a circle and its radius as arguments and returns a 2-column matrix containing the coordinates of 96 points of that circle. This structure is only used for plotting. You can see in the plots that I place the first column at the abscissa (x-coordinates) and the second column at the ordinate (y-coordinates).

The first pair is [NaN NaN] which was chosen for two reasons:

1) Its easier to program if we can already start with a two column matrix

2) Its possible to stack multiple matrices representing different circles and plot them with one command (but all in the same color).

So again - "kreis" is only used at the first page of the sheet as its the easiest way for me to plot one or more circles.

For the calculation of the points of intersection or the table you were looking for its not needed at all.

 

 

Hey everyone,

 

one last question, here is the sheet for the calculation of the angle.

 

Can somebody explain me and write me the code in the sheet to create a table, where the variable "hub" runs from 0 to 440. And then calculate the angle. So i get a table with 441 values of "hub" and 441 angles.

 

I know this in c++ where i can prog a loop.

Werner_E
25-Diamond I
(To:Marc2610)

Which angle?

Below your plot nothing seems to be dependent on "Hub" other than x2. So you are looking for the values of "Winkel" when "Hub" changes and "Winkel" is really only dependent on x2? Is that true?

If yes, then the attached file should help.

 

Thank you,

 

now i got the solution. Thanks to everybody.

@Werner_E 

thanks for the table solution without the vectors, so i understand the syntax.

ttokoro
20-Turquoise
(To:Werner_E)

Thanks to Werner_E for your very good Mathcad sheets. 

Now I can use your Mathcad sheet and it is very helpful to understand the usage of Mathcad functions.

Tokoro.

 

Thanks_for_Werner_E.png

Announcements

Top Tags