cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead 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

How to collect all variables at one side and constant on the other side

Gilgamesh
4-Participant

How to collect all variables at one side and constant on the other side

 gfdgdfgdfg.JPG

 

Hello,

I have a system of equations, and i would like to collect the variables (and its coefficients) at the left side, and all constants on the right side.

Is there a way to accomplish this? I have tried the collect and simplify commands, but that couldn't do it...

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:Gilgamesh)

I'm afraid neither Mathcad nor Prime offers an automatism for this.

Note that you can write the set also as a multiplication of a 3x3 matrix with a 3x1 vector containing x, y and z that equals a 3x1 vector of constants...

 

Success!
Luc

View solution in original post

10 REPLIES 10
LucMeekes
23-Emerald III
(To:Gilgamesh)

I'm afraid neither Mathcad nor Prime offers an automatism for this.

Note that you can write the set also as a multiplication of a 3x3 matrix with a 3x1 vector containing x, y and z that equals a 3x1 vector of constants...

 

Success!
Luc

Gilgamesh
4-Participant
(To:LucMeekes)

Thank you for your answer, LucMeekes.

But i didn't quite catch the alternative method you suggested. 

Could you explain it again please?

What Luc is talking about is Matrix representations:

Capture.PNG

LucMeekes
23-Emerald III
(To:Gilgamesh)

As Fred showed, see above.

In your case it comes down to (mistakes corrected):

LM_20180104_Collect.png

 

Success!
Luc

Hmmm!Capture.PNG

I guess the point of your question was, if Mathcads/Primes symbolics would be able to manipulate equations and the answer was already given by Luc and it was a disappointing "no".  At least its not possible to do it automatically and even manually its a lot of copy and paste, as its not even possible to tell Prime to add a constant to both sides of an equation. Prime can't manipulate equations at all. All thats possible is to simplify both sides of it  - nothing more.

 

In case you are just interested in solving this system of equations in Mathcad you were already given some ways to do so - but all with some manual work done before. This is kind of failure prone (Lucs 4+7=11 should have been a 2*4+7=15).

But of course Mathcad/Prime is able to solve the system just the way you had it written. You may use either the symbolics

Bild1.png

or a numeric solve block to do so

Bild2.png

Here is a (clumsy and awkward) way to achieve what you had demanded which does its job without manual copy and paste, etc. Its not perfect and will fail if the variable you solve for (in my example x) does not exist in the equation.

I was just curious if it would be possible at all to achieve what you asked for and to some extent it is. But I am pretty sure its not worth the effort:

Bild1.png

 BTW, solving for x ensures that the coefficient of x on the LHS is always positive.

 

If you are concerned as of the red errors which stem from the numeric engine, you may either replace "equ" by "equ(x,y,z)" or add a symbolic evaluation when you define the equation (as shown below with equ2):

Bild2.png

 

*** DELETED ***

Why can't we delete our posts as long as nobody replied to it like in most other forums, including the former Jive forum here?

LucMeekes
23-Emerald III
(To:Gilgamesh)

And then there is:LM_20180105_Collect.png

 

Where the expression at the bottom comes close(st) to what you want.

 

Luc

I am not sure if using other software is an option (you may consider using the "simplify" command in WolframAlpha). In fact we don't even know if Gilgamesh is using Prime or real Mathcad (15 or below). In Mathcad we could turn the steps I showed above into a convenient function - in Prime thats not possible.

If other software is an option, there are a lot of better alternatives. If it should be free, Maxima or Geogebra come to mind. They all are capable of manipulating (manually or automatically) equations better than Mathcads/Primes symbolics.

Here is an example with a few ways done with Geogebra (we could create a user defined command("tool") to do the dirty work in the background):

Bild.png

 

Top Tags