Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
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?
It is very hard to find any help on this as "function" is included in tons of Mathcad help discussions.
Thanks!
Solved! Go to Solution.
When including a function within a function be careful to include its arguments on the RHS of the definition- see attached.
Alan
You could try posting a worksheet.
Mike
When including a function within a function be careful to include its arguments on the RHS of the definition- see attached.
Alan
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?
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.
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
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.
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
Strnage behavior.
It seems like the varibles passed as arguments of f are being added to the value of P.
Mike
Mike Armstrong wrote:
Strnage behavior.
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
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:
Another way.
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