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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

trigonometric equation formating

DU_8998062
3-Visitor

trigonometric equation formating

Can anyone tell me the correct syntax for using trigonometric functions?  When I try it, I get an error result that says "missing term or expression".  All help appreciated

50 REPLIES 50

1. What version of the program are you using?

2. Please show your example.

Hi,

Like this:

Capture.JPG

My equations look just like yours except instead of an answer of 0.7071, I get an error message "missing term or expression"

Werner_E
25-Diamond I
(To:DU_8998062)

As you do not show what you are actually trying we have to stab in the dark 😞

The error message you mention is thrown when you don't provide a function argument (by default you would see a question mark instead of the three dots)

Werner_E_1-1675951843845.png

But as this is very obvious I guess that's not the problem which you experience.

So for sure you would need to show examples of what you are doing and it also may help if you state which kind of Mathcad you are using (real, legacy Mathcad 15 or below or Prime) and which version.

 

The error message comes after the equal sign. It looks just like your bottom equation but instead of giving the answer of 0.5, it gives the error message. I am using Prime 8.0

Werner_E
25-Diamond I
(To:DU_8998062)

Can you post the failing worksheet or at least a screenshot!?
Have you tried what I show in the second line (pi/6) with the same error?

Have you tried too use the unit "deg" instead of "°" as seen in Terrys answer. You may explicitly type a multiplication after the number as Terry did, but it should not be necessary, just type "deg" after the number. That way you won't see a dot between the two

Werner_E_0-1675983589977.png

Are the letters "sin" upright or italic? When you click somewhere in "sin" and then look at menu Math-Style-Label, do you see "Function" as in the screenshot below or something else? If something else, does it help when you manually change the label to "Function"? Changing it to "Automatic" should work as well.

Werner_E_0-1675984354847.png

Actually I don't think that wrong labelling is the cause as the error message would be something else ("variable undefined") if that would be the case, but without seeing what you actually typed and without being able to play around with your worksheet we still are just stabbing in the dark 😞

 

You sure have typed the normal equal sign and not the fat boolean one which you get with Ctrl-+ !? Guess that could not be the cause, either, as if you use the boolean equal you won't get any error message - Prime would just wait for you to type in the RHS of the equation and tell it what you want to be done with the equation.

 

When you are using the inverse sinus (arcsin, in Prime called asin) and want to see the result in degree rather than the default radian, you unfortunately can't simply type "°" as we can do in real Mathcad. In Prime we get the exact error message you experience. You either have to type "deg" in the unit placeholder or uncomfortably chose the unit degree from the units menu.

Werner_E_1-1675984725831.png

But then you sure did not want the result of the sine function to be displayed in degree as the result isn't an angle anyway.

 

So again just a lot of shots in the dark...

 

Do you experience any problems with the attached worksheet?
It sure will look OK when you just open it as all you see is the last view I had over here. You should let the sheet recalculate (F9 or F5) to see what your installation of Prime thinks of it.

I am using Prime 6 but I don't think that such a severe bug could have found its way in P8 an remained undetected until now.

Here is what you should see, also after recalculation:

Werner_E_0-1675985731299.png

 

And one last try: You didn't do this (putting the angle outside of the parentheses), didn't you?

Werner_E_0-1675985980666.png

 

upload_-aW1hZ2UucG5n-8914008384735128273..png
Here is what I am getting. As you can see, I tried your suggestion regarding the sin(30 deg) without the multiplier dot included and got the one on the top left.

Hi,

There are three equals signs in Prime each one is different

:=  assignment equals

= output equals

= equivalence

 

 

Capture.JPG

Well okay then. I only know of the one equal sign, :=. How do you incorporate the other types of equal signs? What keys?

Werner_E
25-Diamond I
(To:DU_8998062)

It really would  have helped if you had attached your worksheet as well!

 


@DU_8998062 wrote:
Well okay then. I only know of the one equal sign, :=. How do you incorporate the other types of equal signs? What keys?


Actually there are two more "equal signs" additionally to the three mentioned by Terry - the symbolic evaluation and the global definition.

But you seem to know already at least of two different equal signs as we see that you had used them in your picture (and they sure are the most important two equal signs you should know of).

Obviously you used the "normal" equal sign (numeric evaluation) when you got the correct result for sin (30 deg).

Werner_E_0-1675991555319.png

And you used the assignment/definition equal (which you get by simply typing a colon ":")  when you assigned the value 45 deg to phi and theta.

Werner_E_1-1675991586969.png

In all expressions which failed I see an assignment := instead of an evaluation =.
Did you type this? if so, than thats the culprit.
You have to type just a normal equal sign to numerically evaluate an expression.

Example:

Werner_E_2-1675992021807.png

The first region is an assignment/definiton (note the colon ":") - the variable phi is assigned the value pi/6; the variable is defined. And the last two regions are numeric evaluations (note that there is NO colon here!)
See also
https://support.ptc.com/help/mathcad/r8.0/en/index.html#page/PTC_Mathcad_Help/evaluation_operator.html

or

https://support.ptc.com/help/mathcad/r8.0/en/index.html#page/PTC_Mathcad_Help/using_the_definition_and_evaluation_operators.html#wwID0E1ZOR

or

https://support.ptc.com/help/mathcad/r8.0/en/index.html#page/PTC_Mathcad_Help/about_evaluating_math_expressions.html#wwID0EMLEQ

 

BTW, as you already had success with sin(30 deg). It should work as well if you type an explicit multiplication and it should also work using the degree sign. It really looks to me that you always used the assignment definition := instead of the evaluation =

You also have not answered my question if you experienced any problems with the file I had attached when you let prime recalculate it!

 

 

:= assignment equals - [Shift]Colon: buttons

= output equals - Equal button

= equivalence - [Ctrl]Equal buttons

 

Actually buttons/keyboard shortcuts depend on which language keyboard you are using.
E.g. on my german keyboard I get the boolean equal with "Ctrl +" and not with "Ctrl =".

 

The localized help should be of help, but unfortunately isn't.

The German help for P6 claims that there is no keyboard shortcut for the boolean equivalence and the German P8 help claims that the shortcut is Ctrl =, which is true for English language keyboards but not for German ones.
There are quite some other discrepancies, too - localization was done very sloppily (and I am not surprised about that).

 

ppal
17-Peridot
(To:DU_8998062)

Mine works fine. Please see file which I have not attached.

Werner_E
25-Diamond I
(To:ppal)


@ppal wrote:

Mine works fine. Please see file which I have not attached.


Your file contained a small clerical error. I have corrected it in the file not attached here.

cadtelsim
6-Contributor
(To:Werner_E)

Hello,

I'm having the same problem, I read through the discussion here, make sure I'm using the correct operator, and started a whole new worksheet to make sure there are no interference, but still get a wrong calculation output involving trig: 

StuartBruff
23-Emerald III
(To:cadtelsim)


@cadtelsim wrote:

Hello,

I'm having the same problem, I read through the discussion here, make sure I'm using the correct operator, and started a whole new worksheet to make sure there are no interference, but still get a wrong calculation output involving trig: 


2024 09 20 A.png

 

The first part of the problem is straightforward: you still need to define the variable t that appears in the exponent.

 

I don't know what values you are expecting, but if the 49.98 and 62.053 are angles specified in degrees, then the degree symbol needs to be attached to each angle.  The way it is written in your worksheet, the unit is applied to the value of sine(12.073 radians).

 

If you're trying to find Idc at several values of t, then it's better to define Idc as a function of t.

.

2024 09 20 B.png

 

Stuart

cadtelsim
6-Contributor
(To:StuartBruff)

Thank you for your solution, but I'm looking for the value of Idc at the exact time the source voltage is 300 volts. That value is a simple calculation as follows: 

VM_10380528_2-1726791548293.png

should equal 95.942 as calculator returns, but I can not get that value in ptc, could you help me with that? Its highlighted in the worksheet. 

 

 

 

Werner_E
25-Diamond I
(To:cadtelsim)

Didn't you read what Stuart wrote about the placing of the degree symbols?

And the result is the tenfold of the value you name

Werner_E_1-1726793233255.png

You could also make it that way

Werner_E_0-1726793386366.png

but I sure would not suggest doing so.

 

BTW, for future questions it may be better to open a new thread for your question

 

cadtelsim
6-Contributor
(To:Werner_E)

I did read Stuarts note, The calculation now in the new worksheet shows the correct amount. In the original worksheet still shows wrong, 

VM_10380528_0-1726793881954.png new worksheet

 

VM_10380528_1-1726793908598.pngold worksheet. 

But I can clean up my calculations and hopefully that will take care of it. 

 

Werner_E
25-Diamond I
(To:cadtelsim)

OK, I see you changed the resistance value from 0,08 to 0,8.

To decide what went wrong in your old worksheet, you would have to attach it here. Its not possible to debug your picture.

The degree symbol in the second angel looks farther away from the number as it should be and as it is in the correct version. Not sure how you created it. Depending on the language your keyboard is for you may have the degree symbol directly available. Otherwise you can also simply type "deg" (without the quotes) as the 'unit'.

cadtelsim
6-Contributor
(To:Werner_E)

Degree symbol was missing the multiplication sign and hence looked further away but didn't change the output when I corrected it. 

Werner_E
25-Diamond I
(To:cadtelsim)

The problem is that you redefined the sinus function:

Werner_E_0-1726801178848.png

 

When you use sin(...) after this definition, Prime assumes that you want to use you newly defined function (which returns a constant value independent of the argument alpha) and not the built-in sin-function.
You can tell which function is used by looking for the used font - the built-in uses a straight font while your sin-function is displayed in italic.

You could change this manually by labelling the "sin" as "Function" and not as "Variable". But its sure better not to use "sin" as a function name for a user defined function.

cadtelsim
6-Contributor
(To:Werner_E)

Thank you for this clear explanation. Makes sense now. Are there any classes offered by ptc that you suggest can help me further? 

 

ppal
17-Peridot
(To:cadtelsim)

Lots - depends on where you are.  Online available too.

 

Google would be your friend.

 

But this Forum is excellent  .

Werner_E
25-Diamond I
(To:cadtelsim)


@cadtelsim wrote:

Thank you for this clear explanation. Makes sense now. Are there any classes offered by ptc that you suggest can help me further? 

 


I have no experience with any additional learning material sold by PTC but I always doubted that courses, classes, online tutorials etc. would be of much value. They may be great to get you started but soon after learning by doing is the best approach IMHO.

There is a youtube channel rum by PTC https://www.youtube.com/@PTC_Mathcad/videos which also shows some short explanation videos. Can't say anything about their quality as I don't like videos for learning new stuff. Often they are a waste of time and I sure rather prefer reading, preferably old fashioned analog on paper 😉

I always liked books for learning but I don't have experience with books dealing with Prime and I think that there don't exist many of them. Mathcad sure had the potential but Prime isn't that big of a player in the field of math programs.
The times where software was accompanied by a full fledged user handbook and reference are gone. The user handbook for Mathcad 11 was 500+ printed pages. It still can be found in a pdf version in the depths of the internet and even though Prime misses quite some features of the older version thar handbook still can be valuable.

 

The online help of Prime could be a starting point, too, even though its incomplete, not really well structured and lacks significantly on concrete usage examples.

 

I learned most by trying and failing and trying again.  The pre-predecessor of this forum, the Mathcad collab which was significantly more frequented, was of immense help.

So just try and if you get stuck, don't hesitate ask here in the forum.

 

StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote: 

... I don't like videos for learning new stuff. Often they are a waste of time and I sure rather prefer reading, preferably old fashioned analog on paper.


And it is far harder to skip through the fluff or bits of no interest in a video than in written form.  Transcripts can be helpful in this regard if they're available, but the quality and coverage of transcripts can be flaky.

As the person that runs the channel (as for the quality of the videos, I think they're fantastic), correcting the auto-generated captions or making captions before the video is uploaded to YouTube is really time-consuming, especially with all of the very creative and different ways that the machine chooses to transcribe "PTC Mathcad"... But if you look past that, the transcripts are not unusably terrible.

Secretly, I share your preferences for written explanations over video ones, but research says that the majority of people prefer video, so... 😫

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
cadtelsim
6-Contributor
(To:DJNewman)

Thank you for your message. I appreciate the available videos on PTC Mathcad, the quality of which I have no complain about. Personally, I have not been able to find content that helps me in my field of study. I am very interested in Mathcad and have been trying to employ it as an Electrical Engineer. With little time I have available to spend on figuring it out (since it's not a requirement), my progress has been very slow. I have reached out regarding possible courses that could help but haven't been helped. Thanks again. 

Ah, you're an electrical engineer.

 

One of my very top marketing priorities is to have a dedicated webinar, "Mathcad for Electrical Engineers", happen. (This involves having an outside, non-PTC speaker from the industry or academia. We've had similar events for civil engineers and mechanical engineers already.)

It was supposed to have already happened in mid-2024 but... very unfortunate things happened with the person we had slated as the subject-matter expert. I'm still working very actively on finding someone else. My apologies that we haven't had specific content on your area yet.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
Announcements

Top Tags