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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Is there a way to use clear(...) function to clear existing math function?

yoohooos
11-Garnet

Is there a way to use clear(...) function to clear existing math function?

I have a function where in a form of f(x):=1*x+3. I was trying to use clear(..) function to this clear the this function[clear(f(x)] like I do with the rest of the variables. But then MathCAD gave me error red box around the and said "A variable name is required here". What exactly happens here and is there a way to fix it? Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald II
(To:yoohooos)

You just need to give it the function name.

 

2020 04 16 A.png

 

Stuart

View solution in original post

4 REPLIES 4
StuartBruff
23-Emerald II
(To:yoohooos)

You just need to give it the function name.

 

2020 04 16 A.png

 

Stuart

Just had a quick play with clear. Given your error message with clear(f(x)), I was kind of hoping (against hope) that there may have been a way to evaluate an expression that resulted in a "variable" name, and hence programmatically clear a variable by constructing its name.

This would be a very useful feature to have when creating temporary functions and variables. If say, the names all had the same structure, eg var_nnn (where nnn is a number), then one could have whizzed together a quick function / array+range variable / whatever and iterate over that.

However, clear breaks the normal Mathcad rules about everything being an expression, and is an imperative statement that doesn't return a value and hence can't be used as a function (or even return a value indicating it succeeded!).

(Of course, I'd also like a create function to go along with a clear function, that did the opposite and created a variable with a given name. And while I'm at it, I'd also like a function (funname ?) that returned a string with a function's name).

But I'd also like World Peace and to be on the first hyperspace-capable spaceship on it maiden voyage to Proxima Centauri ...

@yoohooos,

 

Addition to the information provided by @StuartBruff the following article may also help for more clarification.

 

How to clear the numerical values defined for the variables while performing symbolic calculations in Mathcad Prime

 

Regards,

Vipul

VladimirN
24-Ruby II
(To:VipulT)

Here it is.

Top Tags