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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Define symbolic variable and solve it Mathcad 8

S1
8-Gravel
8-Gravel

Define symbolic variable and solve it Mathcad 8

Hi!

Assume the following simple equations, which I want first to define x=b+5 and later solve the second equation for b.

How can I do that?

 

S1_0-1687960416809.png

 

The same question when we add units as well. Here, I think I need a symbolic variable (a) defined first and then solve Z for a to find the a.

Any help is much appreciated.

 

S1_1-1687960841082.png

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:S1)

You should always attach your sheet as well, not just the pictures and it makes sense to say which version of Prime you are using (I tend to overlook the info in the subject ;-)!

 

Here are a few ways to deal with your first example:

  1. Solve it as a system of equations in x and b
    Werner_E_0-1687967173832.png
  2. Use the symbolic "substitute" command/modifier
    Werner_E_1-1687967223829.png
  3. This one comes close to what you tried. The error stems from the numeric engine as it doesn't know what to do with the unknown variable b. The symbolic engine will happily respect this definition, though
    Werner_E_2-1687967384432.png
  4. If you want to avoid the error, you would have to turn x into a function of b
    Werner_E_3-1687967461848.png
  5. And of course you can always calculate b after having Prime find the solutions for x
    Werner_E_4-1687967572827.png

    Unfortunately

    Werner_E_6-1687967617983.png
    does not work as Prime isn't really good at solving vector equations 😞
    You would have to use something like
    Werner_E_7-1687967923772.png

    which is prohibiting!

 

 

By the way, questioners here are expected to come back and close the threads they opened.
-> Solve equation with/without units - PTC Community

View solution in original post

6 REPLIES 6
Werner_E
25-Diamond I
(To:S1)

You should always attach your sheet as well, not just the pictures and it makes sense to say which version of Prime you are using (I tend to overlook the info in the subject ;-)!

 

Here are a few ways to deal with your first example:

  1. Solve it as a system of equations in x and b
    Werner_E_0-1687967173832.png
  2. Use the symbolic "substitute" command/modifier
    Werner_E_1-1687967223829.png
  3. This one comes close to what you tried. The error stems from the numeric engine as it doesn't know what to do with the unknown variable b. The symbolic engine will happily respect this definition, though
    Werner_E_2-1687967384432.png
  4. If you want to avoid the error, you would have to turn x into a function of b
    Werner_E_3-1687967461848.png
  5. And of course you can always calculate b after having Prime find the solutions for x
    Werner_E_4-1687967572827.png

    Unfortunately

    Werner_E_6-1687967617983.png
    does not work as Prime isn't really good at solving vector equations 😞
    You would have to use something like
    Werner_E_7-1687967923772.png

    which is prohibiting!

 

 

By the way, questioners here are expected to come back and close the threads they opened.
-> Solve equation with/without units - PTC Community

Werner_E
25-Diamond I
(To:Werner_E)

Your second problem has to do with Primes buggy and faulty auto-labeling. As can be seen in your screenshot, some of the units (m, s) are not blue which means they are not considered being units. This makes the numeric evaluation at the end fail because this s and m are considered unknown variables. The wrong different labeling of the two "s" is also the reason why Prime does not cancel the seconds.

So far there is no fix for this known bug, just a few workarounds which you can try - they may help or may not 😞

In the calc options you should check the option to use units and constants in symbolics.

Sometimes it helps to manually re-label the units in the definitions as being units.

Sometimes it helps to retype the one or other expression

You may also try to add "substitute, m=m" in the symbolic evaluation. The first m should be labeled as "Variable", the second as "Unit".

Good luck!

Werner_E_0-1687969470998.png

In case you wonder why the sine is not numerically evaluated - this is because Primes symbolics does not know anything about units and treats them as unknowns. If you want the symbolics to evaluate the sine, you have to define deg:=pi/180 somewhere at the top of the sheet (deg should be labeled as unit).

 

And in case you wonder why Primes symolics automatically switch to float mode and show 0.6666666.. instead of the exact 2/3. This is because of the number 1.4 you used in the definition of Z and the 0.0005 for B. As soon as just one single floating point number is involved, the symbolics switch completely in float mode. A nasty habit. You can avoid it in your example if you use 14/10 (or 7/5 of course) instead of 1.4 and 5/10000 instead of 0.0005.

 

S1
8-Gravel
8-Gravel
(To:Werner_E)

Thank you so much for your swift reply.

I tried your suggestions for the second problem, but couldn't manage!

would you please attach your sheet please?

 

Thanks again.

Werner_E
25-Diamond I
(To:S1)


@S1 wrote:

Thank you so much for your swift reply.

I tried your suggestions for the second problem, but couldn't manage!

would you please attach your sheet please?

 

Thanks again.


Sorry, I had not kept/saved the sheet. And even if I would had done so, you would not be able to open it as it was done in Prime 9.

I can only suggest that turn on the usage of units/constants in symbolics and then retype all assignments and expressions from scratch. Often this helps as the erroneous  auto-labeling most often happens when using the symbolics and when editing expressions back and forth. Other options you may try (relabel units, usage of substitute,s=s,m=m were already mentioned above. No guarantee be if you play around you may have success.

 

Of course the preferred way should be to avoid the symbolics and use Primes numeric solvers (root function or a solve block with find). And to express that one quantity is dependent on another we should use functions.

Werner_E_2-1687977315558.png

 

 

Werner_E_1-1687977137713.png

 

Prime 9 worksheet attached 😉

 

EDIT: BTW, I just tried to symbolically solve the equation using this functional approach and ran into the wrong auto-label bug.
I placed the cursor in every unit (s, m, deg) in the definition of C, B and theta and pressed Ctrl-U to label it as unit manually. And voila, the symbolic eval worked and could be followed by a numeric one.

Werner_E_0-1687977890553.png

 

 

 

LucMeekes
23-Emerald III
(To:Werner_E)

Werner's sheet converted to Prime 6.

 

Success!
Luc

ttokoro
20-Turquoise
(To:S1)

image.png

If you have this error, Put the two definitions before it.

image.pngimage.png

Then you can get.

image.png

Announcements

Top Tags