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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

7-Bedrock

## 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
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

23 REPLIES 23
17-Peridot
(To:Raisch)

Would this second alternative help?

7-Bedrock
(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:

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?

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!

7-Bedrock
(To:TomD.inPDX)

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

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!

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

7-Bedrock
(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.

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

7-Bedrock
(To:TomD.inPDX)

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

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'.

17-Peridot
(To:dschenken)

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.

21-Topaz I
(To:TomD.inPDX)

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.

17-Peridot
(To:dschenken)

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.

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.

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 🙂 )

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 🙂

18-Opal
(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":

18-Opal
(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:

7-Bedrock
(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

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?

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.

7-Bedrock
(To:dschenken)

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

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%2FAbout_Functions_Used_in_Relations.html%23

17-Peridot
(To:dschenken)

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

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:

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.

17-Peridot
(To:TomD.inPDX)

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.

Top Tags