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

7-Bedrock

## Defining a function vector inside a programm

Hi people, It is very strange to me. I can not define a function vector inside a program. Take a look at the problem.

Thank you

Jesus

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby III
(To:LucMeekes)

May be so?

8 REPLIES 8
23-Emerald III
(To:hegel)

Try to define it the same way you defined the first g(x), so with an immediate array, instead of assigning expressions to the first and second elements of the array.

Your definition of A3(a) fails because x is an unknown. This may work if you include a symbolic evaluation at the definition.

(I can't try it out, because I'm limited to Prime express.)

Success!
Luc

24-Ruby III
(To:LucMeekes)

May be so?

7-Bedrock
(To:ValeryOchkov)

Thank you Valery, Luc and Werner.  Here a  synapsis.

23-Emerald III
(To:hegel)

In your application I see no need to define a local function inside the program. All you need is a vector of expressions, or functions if you will. That can also be done in mathcad 11 (where you cannot define local functions inside a program):

Success!
Luc

24-Ruby V
(To:LucMeekes)

Nice, but in Prime you can't use (copy to) symbolic evaluations inside a program 😞

23-Emerald III
(To:Werner_E)

OK, accepted.... Mathcad appears to be able to do without just as well:

Still no need to define an internal function for the application of the OP.

Luc

7-Bedrock
(To:LucMeekes)

I know I know, it is DenkeExperiment.

24-Ruby V
(To:hegel)

The way you try to define your function in A2 would not work outside a program on worksheet level either.

You have to define your function the very same way as you defined g(x) on the very top of your sheet (as Luc and Valery already wrote/showed).

Another way which works also with numerical evaluation is shown below

Of course in this approach g is not a local function but a simple vector variable. So you can't use it as a function inside your program. Your sheet does not show if you intend to do this, though.

If this is your goal and you insist on defining the functions singly, you could use something like this:

Announcements
Top Tags