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

cot cotangent in the equation for Curves

Raisch
5-Regular Member

cot cotangent in the equation for Curves

Hello,

 

I want to use an equation with cotangent in the cylinder coordinate system.
Since cot is not a standard function, I use 1/tan, but I get an error message. Can somebody help me?

1 ACCEPTED SOLUTION

Accepted Solutions
TomD.inPDX
17-Peridot
(To:Raisch)

This is a valid support case.  You have a valid need for a missing function.

 

I'm trying to get to it in reverse, but having all kinds of errors 🙂

 

The closest I got was with the (t+.1) in the two ctan functions.

 

r=(7+(7*2)/sqrt(7^2+2^2*(cos(5*(t+.1)*360)/sin(5*(t+.1)*360))^2))
theta = 360*t
z = 0

 

flower2.PNG

 

 

View solution in original post

23 REPLIES 23
TomD.inPDX
17-Peridot
(To:Raisch)

Would this second alternative help?

 alt.PNG

Raisch
5-Regular Member
(To:TomD.inPDX)

Thanks for the answer. I have already tested this possibility without success.

I want to create two curves with these formulas in the cylinder coordinate system:

Unbenannt.JPG

Many programs, e.g. Excel, can process 1/tan. In Creo I tried the following equations: (Both with error message)

 

r=(7+(7*2)/sqrt(7^2+2^2*(1/tan(5*t*360))^2))
r=(7+(7*2)/sqrt(7^2+2^2*(cos(5*t*360)/sin(5*t*360))^2))

theta = 360*t
z = 0

 

How could I solve this?

TomD.inPDX
17-Peridot
(To:Raisch)

You have a division by zero error on the right side (your atan attempt).

If you replace t with (t+.1) it works but that's not the equation.

 

This tells me you want to process "t" before you fit it to the equation.

You can do this with an "if" statement bypassing the 0-state of "t"

If

t=0

then

myctan=0

else

myctan=cos(5*t*360)/sin(5*t*360)

endif

 

Use the variable "myctan" in place of the cotangent conversion

 

^ syntax not confirmed!

Raisch
5-Regular Member
(To:TomD.inPDX)

Interesting idea, but how do I get it implemented in creo?
In the equation editor or under Relationships?

TomD.inPDX
17-Peridot
(To:Raisch)

Creo allows if-statements, pretty much the way I wrote it.

The relations window is actually a programming window for the most part.

 

Crumb!  noif.PNG

Have you considered creating a support case?  Now you got me curious.  🙂

Raisch
5-Regular Member
(To:TomD.inPDX)

Exactly this error message I got and thought it was up to me.

Is this really a support case or is the error perhaps in the equation or the procedure?

i have no experience with Support.

TomD.inPDX
17-Peridot
(To:Raisch)

This is a valid support case.  You have a valid need for a missing function.

 

I'm trying to get to it in reverse, but having all kinds of errors 🙂

 

The closest I got was with the (t+.1) in the two ctan functions.

 

r=(7+(7*2)/sqrt(7^2+2^2*(cos(5*(t+.1)*360)/sin(5*(t+.1)*360))^2))
theta = 360*t
z = 0

 

flower2.PNG

 

 

View solution in original post

Raisch
5-Regular Member
(To:TomD.inPDX)

Thank you very much for your efforts. I will work with this solution.

dschenken
21-Topaz I
(To:Raisch)

The COT(0) = undefined because of division by zero, so the lack of that function does not cause the problem.

 

In some versions of Creo you can set the From and To values for 't'.

You would think that .5 to 1.5 would also work but it doesn't.

Something about being a closed loop makes it more sensitive to end conditions.

 

Any time the curve crosses "0" it will fail. Since evaluation of "1" is identical to "0" it fails there. COT() is discontinuous at the 0 degree point or any whole multiple of 360.That is probably why the original used rectangular coordinates; to avoid division by zero. The same technique is applied to evaluating parametric curves under the hood in CAD applications to avoid similar problems.

True.  Got it to work though.  Just used an offset to get rid of the divide by 0. 

Since it all clocks to theta, this is easy enough to manage.

 

I wondered about bringing it back to Cartesian.

 

Regardless, it does create a problematic curve as the reversal refuses to be useful pretty quickly. 

Certainly cannot sweep anything along it.

 

TomD.inPDX
17-Peridot
(To:Raisch)


@Raisch wrote:

Thank you very much for your efforts. I will work with this solution.


I took it to another level to see what the fudge-entry affected.  It turns out to be quite controllable.

The added value in (t+.1) is a phase shift in each cell.  So a whole number forces a phase shift of 1, which aligns perfectly at the ends.

And considering this is likely a true reversal, and equation curves are tangent by nature, making these individual cells probably makes them much more usable.

 

angle_control.PNG

TomD.inPDX
17-Peridot
(To:Raisch)

Sorry, got carried away with pictures.  This is all the equations in one place. 

These will work if you are not dependent on the true start location of the curve.

The cell overlays perfectly on the whole (now 🙂 )

 

angle_control_iii.PNG

Give this one a try... this uses theta to reposition the start location.

r=(7+(7*2)/sqrt(7^2+2^2*(cos((t+.5)*180)/sin((t+.5)*180))^2))

theta =-18+36*t

z = 0

/* The GULL 🙂

pausob
16-Pearl
(To:Raisch)

Well, in Creo, you have a cryptic message about something being wrong on the right hand side of the equation, whereas in excel, you have the is better at reporting the problem - namely, division by 0.

 

You should know that you can place the limits on t in parametric equations.  In which case, either equation will "work":

liimts_on_t_in_equations.png

 

pausob
16-Pearl
(To:Raisch)

Another thing I'd like to add about these "curves from equation" in Creo - they're useful for simple things, or for trying things out.  But the results are disappointing if you are trying to use them as a basis for any "accurate" models.  PTC just doesn't give you the control over the point spacing, type of curve, etc...

 

Compare the curve from equation generated by creo (left side) with the curve generated by evaluating the equation in excel and generating x,y,z=0 coordinates for as t: 0->1.  1st example has 100 points (0.01 spacing), 2nd example has 200 points (0.005 spacing).  The curvature graph is similar in both cases, but only the one for the 2nd case is shown:

curvature_of_equations_excel_vs_creo.png

 

 

Raisch
5-Regular Member
(To:pausob)

Thanks to the community. This does not seem to be a trivial Problem.

Actually, I want to create a stretched sine (green in the Picture) with these equations (blue in the Picture).

Does anyone know a better solution for a stretched sinus in Creo?

sinus.JPG

/* sinus

r = 23+(1*sin(t*18*360))
theta = t * 360
z = 0

 

I created the two curves using the following equations:

a=2
b=0.8

/*with plus for the upper curve

r=(23+(a*b)/sqrt(a^2+b^2*(cos(360*(t+.5)*18)/sin(360*(t+.5)*18))^2))

theta =-180+360*t

z = 0

 

/*with minus for the lower curve

r=(23-(a*b)/sqrt(a^2+b^2*(cos(360*(t+.5)*18)/sin(360*(t+.5)*18))^2))

 

Now I tried to make a curve out of it with the sign-function:
r=(23+sign(sin(360*t*18))*(a*b)/sqrt(a^2+b^2*(cos(360*(t+.5)*18)/sin(360*(t+.5)*18))^2))

But I get error Messages. Where is the error?

Does anyone know a better solution for a stretched sinus in Creo?

 

 

 

dschenken
21-Topaz I
(To:Raisch)

You can't use boolean operations in curve equations. SIGN and IF, for example.

 

I think it is because those operations are not differentiable, which largely means that it has points that would have infinite curvature, but might also be discontinuous.

Raisch
5-Regular Member
(To:dschenken)

I don't understand. What better way to proceed? 

dschenken
21-Topaz I
(To:Raisch)

Did you study Calculus? The derivative of a function is the equation of the slope of the function. The derivative needs to be continuous so that every point on a curve has a slope that is nearly the same as a point that is very close to it in order to create a datum curve from it.

 

Example: for the function Y = X^2, the derivative is 2X; the slope at any X is 2X.

 

If a point on a curve has two derivatives, such as from forming a cusp, then it is not continuous. If there is a gap in the curve then it is not contiguous and is also not continuous, and therefore the function that creates it cannot be used to create a datum curve. So you cannot use a function that has infinite changes of slope or gaps.

 

For example Y = ABS(X) should make a Vee shape, but at X=0, the slope is both +1 and -1 at the same time depending on whether one looks a very small distance to the positive or negative. Since the transition from -1 to +1 slope occurs over zero distance, the rate of change is infinite and that is a cusp and so cannot be used as a datum curve generator.

 

The SIGN(X,Y) function uses the ABS() function, which creates cusps and so cannot be used.

 

In addition, the Creo SIGN() takes an X and a Y argument and you supplied only one. It produces a value that is equal to X but has the same sign as Y. This is different than Excel. See http://support.ptc.com/help/creo/creo_pma/usascii/#page/fundamentals%2Ffundamentals%2Ffund_seven_sub...

"cusp" that's the word I was looking for!  Thanks David!

TomD.inPDX
17-Peridot
(To:pausob)


@pausob wrote:

Another thing I'd like to add about these "curves from equation" in Creo - they're useful for simple things, or for trying things out.  But the results are disappointing if you are trying to use them as a basis for any "accurate" models.  PTC just doesn't give you the control over the point spacing, type of curve, etc...

 

Compare the curve from equation generated by creo (left side) with the curve generated by evaluating the equation in excel and generating x,y,z=0 coordinates for as t: 0->1.  1st example has 100 points (0.01 spacing), 2nd example has 200 points (0.005 spacing).  The curvature graph is similar in both cases, but only the one for the 2nd case is shown:

curvature_of_equations_excel_vs_creo.png

 

 


You do have a small bit of control if you have not yet noticed.

When I was working with the involute curve, I would expect a perpendicular from at the start on the circle.

I measured the starting angle to know it's tangent at the curve.  Sure enough, it is the angle to the second point.

I could change the 1st-segment tangent by a significant angle (never reaching 90 degrees, of course) with the model's accuracy settings.

 

My point here is that I could change the distance to the second point by setting the accuracy of the model.

In the case of the equation we are discussion, the starting angle is nearly arbitrary based on the accuracy of the model.

 

The only other thing I've noticed as mentioned before, even if a cusp is defined, Creo seems to convert cusps to a tangents.  That is why it is so hard to just "glue" multiple curves together or manually close ends.  It always seems to introduce an element of asymmetry. 

 

If these curves can be built from Excel curves, why not make a stable graph?

 

You can use all the points you want to create a curve from points (point file: .pts, 30,000 max "point from file").

Put a datum curve through points.

Project the curve into a graph sketch.

Now you can use the graph in one of many geometrical functions.

In sketches, this is evalgraph().

You can use graphs in Sweep operations the same as you would use "trajpar"

Can equation curves use graphs?  Hadn't looked there yet.

Announcements