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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

help solving an equation with vectors symbolically

Christina
6-Contributor

help solving an equation with vectors symbolically

Hello, 

 

I want to solve an equation with vectors symbolically.

The equation itself can be solved symbolically by Mathcad.

The symbolically result of the equation can not be shown, but it can be used if I assign the equation to a function. 

Now I want to use vectors with many data to get a solution for my unknown variable xB. I tried to use a Control variable i, but that did not work.

If the values are inserted into the equation directly, Mathcad finds two Solutions.

So my Question is if someone finds a way to get a solution for xB

and even if it is possible to solve an equation with vectors symbolically

The file is attached below.

 

Thank you for your help! 

 

Christina

 

7 REPLIES 7

Are there always two solutions?

Always one negative and one positive?

And you are interested in both or only the positive ones?

The symbolic solve can be quite tricky and I am thinking of using numerical methods which usually are more stable, but won't give you all solutions to a problem but just one, depending on a guess value.

 

The behaviour here is really strange:

  • When I copy your failing solve expression and delete the variable to solve for I get a solution
  • When I copy the variable to solve for it works, too
  • But when I manually type in the variable to solve for the expression fails again.

I checked that both variable names (copied and manually typed in) are identical (I assigned a variable to one and both evaluated to this very same value) so this should not happen but obviously it does.

I have no idea what the cause may be.

B1.png

 

But knowing how to get the symbolics to provide solutions we can use it to get a nice table with the solutions of all the values in the vector inputs:

B2.png

 

File in P5 format attached

 

 

Christina
6-Contributor
(To:Werner_E)

Thank you for your help.

That helped me a lot!

 

I think you can/must use not Symbolic but Numeric Math. See please the attach!

LucMeekes
23-Emerald III
(To:Christina)

Advice: if you want to work symbolically, then start (fully) symbolically:

Define a function to contain your symbolic solution.

Then use that function to plug in any values. Once you have the function, it doesn't matter if you feed it with a set of simple variables, or with a set of vectors. Note that you may have to use the vectorize operator with vectors.

Below is the solution in Mathcad 11. It is very wide, so I cut it off. Note that I defined the solution function lsg a function of all symbols that appear in the equation, except xB.

Note also that the solution is a vector of two elements for a set of simple variables. If you feed it vectors, it will likely produce a vector of vectors...

LM_20181114_Solve.png

I guess the result is so big, that if you would use the submatrix function each of the elements would still be too big.

 

Success!
Luc

Christina
6-Contributor
(To:LucMeekes)

Hello,

could you sent me your Mathcad11 file, so I can try it with this solution too?

The symbolic solution is also a good way, but I have too many datapoints.

 

LucMeekes
23-Emerald III
(To:Christina)

Here you go.

I had to recreate the file.

Note that you cannot read the file directly in any version of Prime. You would have to convert it first.

But I advise to just use Mathcad 15 to open the file.

 

Success!
Luc

Hi. What you have it's just a second degree polynomial in xB. For solving it, take only the numerator and cross your fingers hoping that the denominator don't goes to zero. Mathcad 11 have not problems them to show the coeffs for the polynomial, but isn't the case for Mathcad 15. Even that, with some help, can found the coeffs too. From those coeffs, you can easy write the zeros, but needs less variables (this is, assign some numerical values for some variables) for get something more readable.

 

Clipboard16.gif

 

Best regards.

Alvaro.

Top Tags