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

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

7-Bedrock

## Can I define squared variables?

Hello.  I'm new to Mathcad, and I'm trying out some symbolic variable definitions.  Can I define a variable like this? :

I have tried to mimic the w^2 term, but I am unable to set an assignment statement.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:gshockxcc)

Use the literal subscript.

And if you experience troubles, show and attach your worksheet.

What are you trying to do after you made the assignment?

If you really try to ASSIGN, you can only use the variable itself, not its squared value.

4 REPLIES 4
24-Ruby V
(To:gshockxcc)

Use the literal subscript.

And if you experience troubles, show and attach your worksheet.

What are you trying to do after you made the assignment?

If you really try to ASSIGN, you can only use the variable itself, not its squared value.

7-Bedrock
(To:Werner_E)

Being new to Mathcad, I've tried to absorb as much as I can from the tutorials, but sometimes it's as simple as understanding what I can/can't do.  I repeated the logic you showed above, and it seems to work fine.  The reason that I wanted to write the formula in the form that I did is because I may be solving for w_c1, c_c1, or u_c1, depending on the conditions of the problem that I'm solving.  Obviously, I would just edit the "solve" statement to change the variable that I'm solving for.

Any thoughts on that approach, or better ways to set this up?

24-Ruby V
(To:gshockxcc)

If you need both solutions, you probably have to stick with the symbolic "solve". If a single numeric result suffices, you may also use either a numeric solve block or the "root" command in one of its two flavours.

You may assign the result of the symbolic evaluation a variable and access the single values using the vector/matrix index (in the pic a numeric eval as well a symbolic one is shown)

You may as well turn the calculation into a function of the two input values and use it to compare the results for different inputs:

Again you can use this function either with symbolic or with numeric evaluation:

In case only the non-negative result is of interest you may use the "assign" modifier. Primes symbolic is rather weak compared to real symbolic math programs like Maple or Mathematica and so "assign" only works the way you may intend it if you are lucky.

Here you see a rather silly result because Prime should know that the sum of the squares of real numbers can't be negative:

But, surprise! When we actually use this function we get exactly what we intended - the non-negative solution only.

19-Tanzanite
(To:gshockxcc)

Using  for variable name, is also can, but not recommended.

Announcements