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

How to define a function with constants

CS_11
3-Visitor

How to define a function with constants

I'm trying to define a function where a,b and R are constants. I set the labels to constant but I get an error. constant lable.PNG

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:CS_11)

The error message stems from Primes numeric engine as it can't do calculation with variables not assigned a value.

As you have seen you still can do symbolic operations without any problem so it does no harm but just is bad looking.

 

To avoid the error you have two options:

1) Define the function as P(v,T,a,b):=.... or as P(a,b,v,T):=...

2) assign a and b values before defining. The type clear.sym(a,b) and then do your symbolic calculations
To clear the variables after that completely also for numeric use, you may type clear(a,b)

 

Werner_E_0-1601495358541.png

 

View solution in original post

1 REPLY 1
Werner_E
25-Diamond I
(To:CS_11)

The error message stems from Primes numeric engine as it can't do calculation with variables not assigned a value.

As you have seen you still can do symbolic operations without any problem so it does no harm but just is bad looking.

 

To avoid the error you have two options:

1) Define the function as P(v,T,a,b):=.... or as P(a,b,v,T):=...

2) assign a and b values before defining. The type clear.sym(a,b) and then do your symbolic calculations
To clear the variables after that completely also for numeric use, you may type clear(a,b)

 

Werner_E_0-1601495358541.png

 

Announcements

Top Tags