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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Mathcad Symbolic Solution includes "function"?

snorville
1-Newbie

Mathcad Symbolic Solution includes "function"?

I'm a student using Mathcad 14 to perform symbolic calculations for stability analysis problems. Basically, I'm am taking multiple derivatives of multivariable symbolic functions. When I evaluate symbolically, I find a term in the solution 'function'. I don't know what this means or what 'function' it may be replacing. Have I accidentally changed a sheet setting or something?

Capture.PNG

It is very hard to find any help on this as "function" is included in tons of Mathcad help discussions.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

When including a function within a function be careful to include its arguments on the RHS of the definition- see attached.

Alan

View solution in original post

13 REPLIES 13
MikeArmstrong
5-Regular Member
(To:snorville)

You could try posting a worksheet.

Mike

I highlighted the first instance of this problem.

When including a function within a function be careful to include its arguments on the RHS of the definition- see attached.

Alan

MikeArmstrong
5-Regular Member
(To:AlanStevens)

Nicely spotted Alan.

Actually the error message if you can call it that makes sense for once. Was the text 'function' in the equation indicating that there was a problem with function P directly?

If that would have been a numerical evaluation the error message would have called up a problem with the number of arguments wouldn't it?

Clipboard01.jpg

Mike

As I understood it, there was no indication about which function was causing the error, no spotlight of function P. It was really my bad defining a new function P(variables) (should have named it something else) when I was using other functions referring to a variable P.

I often keep my warnings turned off, in this case they may have caught it for me.

PhilipOakley
5-Regular Member
(To:MikeArmstrong)

The final P(a,b) result is interesting as it shows that mathcad has a computer science feature called Currying.

Currying is work looking up for all you formal logic buffs. It helps explain many of the 'unusual' things with MathCAD

Philip

MikeArmstrong
5-Regular Member
(To:PhilipOakley)

The final P(a,b) result is interesting as it shows that mathcad has a computer science feature called Currying.

Yes I agree. Not sure I understand the logic behind it though.

The first evaluation of P tells the user that he is missing three arguments, but the second tells something totally different.

Mike

Yes, the result implies I could use it in a way like P(20,30)(2)=52 but that syntactically incorrect. Assigning to a single variable funciton fails too, but assigning to f(x,y) its OK even though the first parameter obviously is ignored!? No logic visible to me.

Func_P1.png

Philip Oakley schrieb:

The final P(a,b) result is interesting as it shows that mathcad has a computer science feature called Currying.

Currying is work looking up for all you formal logic buffs. It helps explain many of the 'unusual' things with MathCAD

Philip

MikeArmstrong
5-Regular Member
(To:rag)

Strnage behavior.

Clipboard01.jpg

It seems like the varibles passed as arguments of f are being added to the value of P.

Mike

PhilipOakley
5-Regular Member
(To:MikeArmstrong)

Mike Armstrong wrote:

Strnage behavior.

Clipboard01.jpg

It seems like the varibles passed as arguments of f are being added to the value of P.

Mike

Mike,

It's not strange at all

You have defined a function P that takes in three named parameters.

You then define a function f that takes one parameter, and returns the value of the function P, which has been give two different parameters, these two parameters are the values named a and b which you defined earlier as 10 and 20. (P will want three parameters so is currently one short)

Finally, you ask the function f to evaluate when given a list of two parameters (numeric values this time). The first one is taken by f's function definition to be x, (which is promptly ignored (value 1) because it doesn't occur on the rhs). The second one is left hanging spare as the function evaluates its definition, which is the function P. P wants three parameters, you'd given it two within the definition of F, and then there was the spare numeric value (4) from the parameter list, so P grabs that and evaluates the expression a+b+4 => 10+20+4 => 34.

Voila, just as expected - It was what you expected wasn't it? ... OK so I had some difficulty with this a while back and Tom G and Stuart B provided most of the background then Wikipedia a load more, and then I was hooked and read up about Haskel (Language) and Currying (Technique), and F# for those who want more than C#...

Philip

MikeArmstrong
5-Regular Member
(To:PhilipOakley)

No it seems logical cheers.

Voila, just as expected - It was what you expected wasn't it? ... OK so I had some difficulty with this a while back and Tom G and Stuart B provided most of the background then Wikipedia a load more, and then I was hooked and read up about Haskel (Language) and Currying (Technique), and F# for those who want more than C#...

Look what you've done now.

Work put away - start researching something that has no relevance with my current work commitments

Mike

Ah! I just found out it works THAT way:

Func_P2.png

MikeArmstrong
5-Regular Member
(To:rag)

Another way.

Clipboard01.jpg

As you said above it looks like the first argument of f is ignored. Don't really understand why the arguments are being added to the value of P.

Mike

Top Tags