Skip to main content
23-Emerald V
April 4, 2020
Question

Convert function name to string?

  • April 4, 2020
  • 1 reply
  • 2243 views

Noticing in Prime Express that evaluating a function name yields a string, ... 

 

2020 04 04 A.jpg

I was wondering if anybody knows of a way to save that string to a variable?

 

 

(This is something that I asked for since about Mathcad 11 - it would have been quite handy to have when, say, evaluating a list of functions or identifying a function that's stored as an array element)

1 reply

23-Emerald IV
April 5, 2020

The obvious doesn't work:

LucMeekes_0-1586108645653.png

Unfortunately the variable 'a' is NOT a string, as shown by:

LucMeekes_1-1586108691948.png

(Complains that "This value must be a string")

Instead, a is now (also) the sine function:

LucMeekes_2-1586108827549.png

Note: This works the same way in Mathcad 11:

LucMeekes_4-1586109123948.png

Success!
Luc

23-Emerald V
April 6, 2020

Thanks, Luc.

 

I already tried your suggestion, even though I knew it wouldn't work (otherwise assigning functions to names wouldn't!!), but I was wondering if there was some operation that would do the job, eg, something along the lines of converting a range variable into a vector, ...

 

2020 04 06 A.png

23-Emerald I
April 7, 2020

You might be able to do it in a program

       name <--sin

  return name

 

Constrained to Express, I can only speculate. . .