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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

"This Value Must Be a Function"--Issue with Prime 3.0

mferguson-2
1-Visitor

"This Value Must Be a Function"--Issue with Prime 3.0

So, I'm completely new to Mathcad and am literally using it for my first time ever for a grad assignment. I am having difficulties with a couple of things in particular.

First, and most importantly, I am getting an error which states "This value must be a function." Having defined the term and function in question previously, I am just not sure where I'm going wrong. I'm sure it's something easy about how I'm typing it in or what I forgot to do, but I need someone more experienced to help me out.

Secondly, in the "error 2" worksheet attached, I am getting an error about incompatible units. If anyone could help me with one or both of these errors, I'd greatly appreciate it. Sorry for my lack of knowledge of the program.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:mferguson-2)

1) You have to type a multiplication sign between "w" and "(", otherwise a fuction w(..) is assumed. After you correct this error ou then run into a unit mismatch - check your formulas.

2) In your program body you have used the vector index when you typed L_h but you should have used the literal index. There is also a unit mismatch in the second ("parabolic") part of your routine where you try to add an area and a length.

Furthermore I guess that in the first part you should not use "if ... if .. else ..." but rather "if.. else if ... else..."

P.S.: You don't have to apology for lack of knowledge.

View solution in original post

7 REPLIES 7
Werner_E
25-Diamond I
(To:mferguson-2)

1) You have to type a multiplication sign between "w" and "(", otherwise a fuction w(..) is assumed. After you correct this error ou then run into a unit mismatch - check your formulas.

2) In your program body you have used the vector index when you typed L_h but you should have used the literal index. There is also a unit mismatch in the second ("parabolic") part of your routine where you try to add an area and a length.

Furthermore I guess that in the first part you should not use "if ... if .. else ..." but rather "if.. else if ... else..."

P.S.: You don't have to apology for lack of knowledge.

You didn't define e_c (that I could see), but you happened to choose one of the built-in constants in Mathcad; = 1.603*10^-19 C.

Your equation expects a length, so you got an "incompatible units" flag.

Fred Kohlhepp wrote:

You didn't define e_c (that I could see), but you happened to choose one of the built-in constants in

e_c is the second argument of the function profile() and it is passed the worksheet variable e which is a lenght. So I guess that this part is OK.

My point was that e_c has a preassigned value and unit (which is not a length) It was never defined as a length in the sheet, so it causes a conflict in the function.

Fred Kohlhepp wrote:

My point was that e_c has a preassigned value and unit (which is not a length) It was never defined as a length in the sheet, so it causes a conflict in the function.

No, i don't think that there is a conflict. Mathcad is not using the predefined constant because e_c is a formal function argument.

profile(..., e_c, ....):= ....<usage of e_c> .....

Then he calls

profile(......, e, ....) =

and the actual argument e (which is a lenght) is passed to the function, so there should be no problem.

You're right.

Once we sort out the difference between literal and index subscripts, and a few other unit errors:

Thank you both a ton. I see my mistakes very clearly now. Hopefully it'll be smooth sailing for the rest of the assignment!

Announcements

Top Tags