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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Defining a function vector inside a programm

hegel
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

ACCEPTED SOLUTION

Accepted Solutions

8 REPLIES 8
LucMeekes
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

May be so?

y2.png

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

LucMeekes
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):

LM_20180116_VectorOfFunctions.png

Success!
Luc

Werner_E
25-Diamond I
(To:LucMeekes)

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

 
LucMeekes
23-Emerald III
(To:Werner_E)

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

LM_20180116_VectorOfFunctions1.png

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

 

Luc

hegel
7-Bedrock
(To:LucMeekes)

I know I know, it is DenkeExperiment. 

Werner_E
25-Diamond I
(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

Bild.png

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:

Bild2.png

 

Announcements

Top Tags