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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

System of Equations Mathcad Prime 7 - result returned is too large to display

Cornel
18-Opal

System of Equations Mathcad Prime 7 - result returned is too large to display

Hello,

CornelBejan_0-1674026935850.png


Thank you.
Mathcad Prime 7 file attached.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:Cornel)

The seven variables you are solving for should not be arguments of the function and you should not use any row or column selectors.

It should look that way

Werner_E_0-1674043286991.png

and while you still would get the message that the results can't be displayed, you should be able to use the function numerically like

Werner_E_1-1674043356802.png

Unfortunately for reasons unknown to me the calculations seems to run endless and so this seems not to work.

 

But there are good news. While the full 1x7 result row vector is (in the opinion of Prime) to large to be displayed, the results can displayed one by one:

Werner_E_2-1674043499688.png

 

EDIT: Actually I have no idea what the problem with evaluation Test(1,2,3,4,5,6,7) would be.

After all, Prime can quickly and easily find a solution that way:

Werner_E_0-1674051398714.png

 

 

 

View solution in original post

35 REPLIES 35
ttokoro
20-Turquoise
(To:Cornel)

If you can fix omega_s then Mathcad return the answer.
So, maybe you need one more equation to solve.

 

image.pngimage.png

So, for now ws need to be defined as symbolical variable. I have 7 unknown variables (iL1s, iL1c, iL2s, iL2c, vC1s, vC1c, vCF) and also 7 equations, therefore should not be a problem with this thing...I mean in such a way that we need to assign for ws (or other variable) a (starting) value or to add more equation(s).

For example, Mathcad 11 can solve this system of equations as it is...without any problem.

Werner_E
24-Ruby V
(To:Cornel)


@Cornel wrote:

So, for now ws need to be defined as symbolical variable. I have 7 unknown variables (iL1s, iL1c, iL2s, iL2c, vC1s, vC1c, vCF) and also 7 equations, therefore should not be a problem with this thing...I mean in such a way that we need to assign for ws (or other variable) a (starting) value or to add more equation(s).

For example, Mathcad 11 can solve this system of equations as it is...without any problem.


Given the error message Prime is also able to solve the system - it just refuses to display the result. MC11 could be modified so that it also shows very large symbolic results, but later Mathcad version and also Prime can not be modified that way.

You may follow the advice and assign the result a variable, or better, a function in omega.s, C1, L1, etc. which you then can use for further calculations.

CornelBejan_0-1674038017877.png

CornelBejan_1-1674038161627.png

CornelBejan_2-1674038190263.png

CornelBejan_3-1674038212394.png

CornelBejan_4-1674038273917.png

 

 

 

 

 

Werner_E
24-Ruby V
(To:Cornel)

The seven variables you are solving for should not be arguments of the function and you should not use any row or column selectors.

It should look that way

Werner_E_0-1674043286991.png

and while you still would get the message that the results can't be displayed, you should be able to use the function numerically like

Werner_E_1-1674043356802.png

Unfortunately for reasons unknown to me the calculations seems to run endless and so this seems not to work.

 

But there are good news. While the full 1x7 result row vector is (in the opinion of Prime) to large to be displayed, the results can displayed one by one:

Werner_E_2-1674043499688.png

 

EDIT: Actually I have no idea what the problem with evaluation Test(1,2,3,4,5,6,7) would be.

After all, Prime can quickly and easily find a solution that way:

Werner_E_0-1674051398714.png

 

 

 

Something seems to be a little strange..
I compared the results from Mathcad Prime 7 with the results from Mathcad 11...and i saw that the resulting expression for vCF is wrong in Mathcad Prime 7, or at least I do not understand at this moment why I get vCF = 0 in Mathcad Prime 7

CornelBejan_1-1674059504291.png

CornelBejan_2-1674059535633.png

 

So, the in front expression of each -iL1s, -iL1c, -iL2s, -iL2c, -vC1s, -vC1c, -vCF are the resulted expressions obtained with Mathcad 11 and iL1s, iL1c, iL2s, iL2c, vC1s, vC1c, vCF are the expressions obtained with Mathcad Prime 7 (of course, from the same system of equations, nothing changed)


I will check once more the resulted equations from Mathcad 11 when I get home, and I will compare them again with those resulted from Mathcad Prime 7, for any...but...

Werner_E
24-Ruby V
(To:Cornel)

The reason for this is that your seven equations are not independent. So the system has an infinite number of solutions. At least thats what Primes symbolics thinks (i have not verified it).

Primes symbolics choses zero for one of the variables (the last one stated) and then solves the remaining system.

 

You can use "solve,....,fully" to tell the symbolics that you wan to see all solutions.

Werner_E_0-1674060735076.png

As you can see in the following screenshot, the solution for the last variable contains _z and _z1 which means that you can use any number for them. I don't know why Prime does not simplify these two to just one arbitrary value even though I use "simplify, max". The other solutions seems to NOT contain any _z or z_1 which means that they are always the same.

Werner_E_1-1674060959697.png

As I see it it means that v.CF can be set to any positive multiple of Rr.

I cannot say if Prime is right in assuming that the equations are dependent and if you still have access to Mathcad 11 I would rather trust the old Maple symbolic engine rather than the new one in Prime 😉

I was loading your sheet in Prime 6 and I just tried to switch to the legacy engine (muPad). But the sheet is still calculation while I am typing this. If it finishes in a decent time, I'll edit and report what the results are, but it looks like I will have to cancel the calculation after a while.

 

EDIT: The result with muPad is not a simple matrix, but an expression with a condition (if). So it can't be evaluated singly. So even though we can't see what muPad comes up with, it looks like it also thinks that the system does not have a single solution!

 

EDIT2: If, after solving the system, you let solve the last equation for v.CF you get what looks similar to the MC11 solution, I guess.  BTW, I mad a mistake in the sheet I posted as for sol[0,2 I used i.L2c instead of i.2s

Werner_E_2-1674063079892.png

 



@Werner_E wrote:

The reason for this is that your seven equations are not independent. So the system has an infinite number of solutions. At least thats what Primes symbolics thinks (i have not verified it).

Primes symbolics choses zero for one of the variables (the last one stated) and then solves the remaining system.

 

You can use "solve,....,fully" to tell the symbolics that you wan to see all solutions.

Werner_E_0-1674060735076.png

As you can see in the following screenshot, the solution for the last variable contains _z and _z1 which means that you can use any number for them. I don't know why Prime does not simplify these two to just one arbitrary value even though I use "simplify, max". The other solutions seems to NOT contain any _z or z_1 which means that they are always the same.

Werner_E_1-1674060959697.png

As I see it it means that v.CF can be set to any positive multiple of Rr.

I cannot say if Prime is right in assuming that the equations are dependent and if you still have access to Mathcad 11 I would rather trust the old Maple symbolic engine rather than the new one in Prime 😉

I was loading your sheet in Prime 6 and I just tried to switch to the legacy engine (muPad). But the sheet is still calculation while I am typing this. If it finishes in a decent time, I'll edit and report what the results are, but it looks like I will have to cancel the calculation after a while.

 

EDIT: The result with muPad is not a simple matrix, but an expression with a condition (if). So it can't be evaluated singly. So even though we can't see what muPad comes up with, it looks like it also thinks that the system does not have a single solution!

 

EDIT2: If, after solving the system, you let solve the last equation for v.CF you get what looks similar to the MC11 solution, I guess.  BTW, I mad a mistake in the sheet I posted as for sol[0,2 I used i.L2c instead of i.2s

Werner_E_2-1674063079892.png

 


@Werner_E wrote:

 

"EDIT: The result with muPad is not a simple matrix, but an expression with a condition (if). So it can't be evaluated singly." 


But is it somehow possible to reach the expression of vCF in Mathcad Prime 7 as it looks like in Mathcad 11? 

 

The idea îs that I need to know all the above expressions (so it also includes vCF) both in symbolic form and later in numerical form, and in principle in Mathcad Prime (Mathcad 11 will not always be at my hand)..

 

EDIT: ok @Werner_E  I saw your EDIT2. I will check, and I will come back with an answer. 

Thank You. 

 

After this system of equations is good, there will be other calculations and as well as other questions, but I will post them one by one... (that there will be other calculations to solve further in Mathcad Prime (7))

Werner_E
24-Ruby V
(To:Cornel)

Given this and also past questions it could be that with Prime you are not using the appropriate tool for your tasks. Prime's symbolics often isn't as capable as you would like it to be. You might consider using something like Maple or Mathematica.

For the time being, circumstances are such that I have Mathcad Prime (7) at my disposal most of the time and can use it. So let's hope that solutions will be found even in Mathcad Prime as well... then, I don't know, but I like to use Mathcad more than Mathematica, Maple or Matlab (these tools are not so friendly from a mathematical point of view like Mathcad and involves quite a bit of writing code, programming, although Maple Flow seems to be very, very close to Mathcad (although here too from what I've seen it until now will involve writing code (for example when you want to plot something, but also for other things), and another thing I don't like about Maple Flow and Maple is that they have procedural programming, then Mathematica involves also of writing lines of code, as well as Matlab)...but for debating these tools I would like to make a separate post here on the forum in the near future for debate and opinions ...

CornelBejan_0-1674069754201.png

I had to manually replace (otherwise I don't know how it could be done in another way, I mean automatically by Mathcad itself) that sqrt(1/...) with 1/(...)^1/2 so that Mathcad knows how to simplify correctly:

CornelBejan_2-1674070003141.png

So, thank you until now @Werner_E 
I will most likely have other calculations further where Mathcad Prime will freeze, but I will post them...

 

CornelBejan_1-1674217536632.png

CornelBejan_2-1674217551337.png

CornelBejan_3-1674217570639.png

CornelBejan_4-1674217588539.png

 

Mathcad Prime 8 file attached.

 

CornelBejan_0-1674298004035.png

CornelBejan_1-1674298087949.png

 

Mathcad Prime 8 file attached.

 

Werner_E
24-Ruby V
(To:Cornel)

So it looks that you have reached the limits of the symbolic engine in Prime.

Have to tried to delete the "simplify,max" from where you define sol(s) and use it when you try to evaluate the first element of sol(s)?

I can't try as all your new calculations seem to run "endless" and i have to cancel them without seeing a result or an error.

 

CornelBejan_2-1674305396808.png

CornelBejan_3-1674305408209.png

CornelBejan_4-1674305425295.png

CornelBejan_5-1674305439531.png

 (for a few minutes he thinks, thinks and thinks). And I think that here, at this calculation, Mathcad Prime will run "endless"...


And for this, same:

CornelBejan_0-1674304272562.png

CornelBejan_1-1674304283765.png

 

Werner_E
24-Ruby V
(To:Cornel)

So the problem seems already to be the "unknown error, Division by 0".
Again you could report it to PTC, but I doubt that this will be of much help.

Is Prime able to calculate the determinant of (s*identity(7)-Aa ? You could then try to use Prime to manually calculate the inverse and maybe you see, where the problem with a division by 0 could be.

Again I could only suggest using a different software package to deal with your problem or to find another way to arrive at the final goal, whatever it may be. I can't think of any "workaround" here.

Is Prime able to calculate the determinant of (s*identity(7)-Aa ? 

CornelBejan_0-1674307157573.png

 

Werner_E
24-Ruby V
(To:Cornel)

Good, so if you really want you could try to manually calculate the elements of the inverse matrix yourself step by step. Sure quite some work to do, though, and unsure if it would be worth the effort at the end.

Do you know any function to extract the submatrix from the matrix that works in Mathcad Prime?

It's ok, I find:

CornelBejan_0-1674310158614.png


Mathcad Prime 8 file attached.

Werner_E
24-Ruby V
(To:Cornel)

I don't understand. The built-in function "submatrix" seems to work OK anyway, as you picture shows.

EDIT: AH, I see now that you had written that you found it yourself.

https://www.wikihow.com/Find-the-Inverse-of-a-3x3-Matrix 
https://www.superprof.co.uk/resources/academic/maths/linear-algebra/determinants/minor-and-cofactor.html

CornelBejan_0-1674310851900.png

 

CornelBejan_1-1674310878233.png

CornelBejan_2-1674310903065.png
How the calculation of minors can be done in Mathcad Prime, with some functions, so I don't have to do it manually?

Mathcad Prime 8 file attached.

Werner_E
24-Ruby V
(To:Cornel)

Maybe the attached sheet can be of help

You can calculate single elements of the inverse and also the whole inverse. I don't use smaller submatrices but I simply replace all values in the appropriate row and column by zeros and then set the element to 1.

No error checking implemented (matrix must be square and non-singular).

 

To get the minors you would have to calculate up to 4 submatrices and then augment and stack them and you will have to consider the special cases first and last row as well as first and last column where you only have to deal with two or even with just one submatrix. I found it easer to do it as described as the determinant is the same anyway.

Werner_E_0-1674311719846.png

Werner_E_1-1674311848340.png

 

 

CornelBejan_0-1674321022456.png
Firstly:
Can the expression of Gc(s) be simplified somehow by dividing the denominator and the numerator by s^30 for example? (in order to be easier for the next step (plotting the bode plot of Gc))

CornelBejan_3-1674321225788.png

 

CornelBejan_1-1674321036550.png

CornelBejan_2-1674321049456.png

 

Werner_E
24-Ruby V
(To:Cornel)

dividing by s^30 wont help as you would run into the very same problems. Dividing by s^15 seems to be OK for this example.

And you should also change the scaling in your plots. At the time being your abscissa is scaled linear and the ordinate is scaled logarithmic - it should be the other way round:

Werner_E_0-1674328114466.png

But IMHO for quite a long time we are moving far too much away from the initial question in this thread.

There is the still open problem with the inverse and now even another one about the Bode plot.

Opening new treads for new questions would be preferred.

Can you also post the Mathcad file?

Ok, I will then open new threads. The reason that I posted these problems only on this topic until now (and I didn't create separate topics for each (because I think with what I have now, I would probably fill the first topic page only with my topics :)))) is that these problems are related somehow to the same topic (that's why I thought initially not to open new topics), only the problems are different depending on the calculation step.

 

 

Werner_E
24-Ruby V
(To:Cornel)


because I think with what I have now, I would probably fill the first topic page only with my topics :)))) i

 


So its better to deal with various problems step by step one after the other and not all at once.

The initial problem seems to be solved. The problem with the inverse seems still unsolved  or could the sheet help to display single elements of the invers matrix? And now the third problem with the bode plot may be solvable by splitting the nominator and denominator - at least with the specific numbers provided in the definition of Gc(s). Its not a generic solution to divide by s^15 which works for all similar functions and there sure are function which can't be treated that way and may refuse the plot whatever you do.

Anyway, I would like to open a topic related to the inverse of a matrix, with the calculation of the respective minors (as it is done classically), if it is possible to make a function as you posted above. because I don't understand how the above program for calculating minors (with null) calculates the minors of a matrix because it is not done that way using the classic method (if I am not mistaken with what I said now about this).

This is the result from Mathematica for the inverse of s*Identity(7)-Aa (see pdf attached).

And, can you also upload the Mathcad file for the Bode plot? (how did you make it appear to you?)

 
 
 

 

 

Werner_E
24-Ruby V
(To:Cornel)

According the inverse: Mathematicas result isn't looking that large. On the other hand - Mathematica is only showing five significant digits while Primes symbolics per default shows 20 which would take much more space. Not sure if using the modifier "float, 5" would help Prime to display the result. Drawback is that this not only affects the display of the result but also the accuracy of the whole calculation.

My method of calculating the inverse in my sheet may not be exactly what you found on the internet. Lets use your example.

Instead of transposing the matrix and deleting the second row and first column in the transposed matrix, I don't transpose but instead set the first ROW and second COLUMN to zero with the exception of the common element.

You would have to change the sign of your result -20 because you have to multiply by (-1)^(i+j) and this is not necessary with the way I had chosen. And setting different values in the original matrix is much easier to implement in Prime than deleting rows and columns.

Werner_E_0-1674343730797.png

For the bode plot I did the very same you did (with the exception of using s^15 instead of s^30). And of course you have to assign nominator and denom to separate functions of s, lets say (Z(s) and N(s). Then you define Gc(s):=Z(s)/N(s) and thats it.

 

And this is the result from Maple (2019 version). Somewhat difficult to understand the result...
It seems at first glance that Maple calculates a bit more complicated compared to Mathematica.

Maybe @ttokoro  (as I saw that he uses Maple) knows how to put the result of the inverse calculation in a more visible format in Maple, in the form of a matrix, as it also looks in Mathematica, for comparison.

Top Tags