Skip to main content
1-Visitor
September 30, 2020
Solved

How to define a function with constants

  • September 30, 2020
  • 1 reply
  • 2244 views

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

Best answer by Werner_E

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

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
September 30, 2020

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