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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

9-Granite

## Explicited expression does not match when saved to a varialble name

Hi

Say I have an expression:

Z(s):= c(s)[a(s)+b(s)]; where s is a variable

When I evaluated them, they are not the same.

Z(s)=

The results is not the same as:

c(s)[a(s)+b(s)]=

Please see attached for a better explanation. The bottom right row result is not the same as the bottom left result. Bottom right row is correct

I think it has to do with some kind of matrix errors

Thanks

Rdliquid

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:rdliquid)

Your function Z(s) is NOT dependent on "s" but on "freq". If you want it to be dependent on "s" you would have to write

EDIT: The pic showed the wrong expression - replaced it for the correct one.

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

Did you type the   [   ( and the     ] )   ?

Then there's your error. You should ONLY type those if you want to make a matrix.

This equation should be typed in as:

c(s)*(a(s)+b(s)).

Success!
Luc

9-Granite
(To:rdliquid)

Hi Luc,

Thanks, no that is just an example and I used "[" instead of "(" for easy viewing the equation. Sorry for the confusion. The attachment will clears things up as what I mean.

I think it has to do with scalar and vector quantity.

Re-attaching the file in case it did not attach the first time

Thanks

Rdliquid

24-Ruby V
(To:rdliquid)

Your function Z(s) is NOT dependent on "s" but on "freq". If you want it to be dependent on "s" you would have to write

EDIT: The pic showed the wrong expression - replaced it for the correct one.

9-Granite
(To:Werner_E)

Hi Werner_E,

Thanks that's it and it makes sense to me now. Still trying to get comfortable with Mathcad 6

Thanks a lot!

Rdliquid

9-Granite
(To:rdliquid)

Have a follow up question on this topic,

Do you know why I can not give a variable "s" in Zin1(s)?

As you can see from below, Zin1(s) give me a unit error and yet Zin2 without variable "s" does not give me any errors? Zin1(s) should be correct since the right side of it depends on "s" right?

Thanks a lot for your helps

Rdliquid

24-Ruby V
(To:rdliquid)

The error message does not make sense and is misleading.

With Z.in2 you are defining a function, not an expression which you can evaluate as in Z.in2.

So simply delete the equal sign after the definition of the function.

When you define Z.in1(s), the s is the formal function argument and has nothing to do with the vector s you defined before. In the second expression in the pic I evaluate the function with the vector s as actual argument.

You could define the function using a completely different name for the formal argument and it would work the very same way. In the pic below I used sigma as formal argument name:

BTW, do you know that you can setup the sheet so that every result shows the imaginary unit as "j" and not as "i"?

9-Granite
(To:Werner_E)

Hi Werner_E,

Thanks a lot for your helps. It makes sense to me now.

I should not evaluate the function Zin1(s) after I defined it on the same line. After I moved down to the next line and evaluated Zin1(s) with the "=" sign and it works!

The reported error caused a lot of confusion for me and I was looking at a different area of the problem and I was unable to figure it out.

Also I did not know that "the s is the formal function argument and has nothing to do with the vector s you defined before". Thanks for that information as well

Not sure about the sheet set up but I am comfortable with using "i" as an imaginary number since school and just do not want to change.

Thanks again,

Rdliquid

24-Ruby V
(To:rdliquid)

If you are happy with "i" thats OK. I just thought to mention that you can change it to "j" throughout as its usual in electro techniques. I also noticed that you used "j" yourself when you defined s or Z(s), etc.

Announcements
Top Tags