Post Reply 
CAS simplifying non-zero expressions to 0
10-06-2014, 03:37 PM
Post: #9
RE: CAS simplifying non-zero expressions to 0
(10-06-2014 01:46 PM)parisse Wrote:  kickniko,

I am Nick. Kickniko is only my member name since Nick was not available.

(10-06-2014 01:46 PM)parisse Wrote:  I just read your first post where you wrote in bold the command simplify(6.0929985e-32*Cvar^2*Omega^8), a mix of floating point value and symbolic expression. It means you have replaced some constant(s) by a numeric value before the end of the computation, and that's the explanation of my previous post. By the way, if I set epsilon to 0 in my emulator, the simplify command above returns the expression unchanged.

This is after all possible symbolic work has finished. Omega is (going to be) the independent variable. (I substitute X for it forplotting later on.) And Cvar will have to take several values, as it is the capacity of a varicap which changes for different resonance freqs. I am not trying to get a single value of abs(Z) for a single value of Omega and Cvar, but to graphically examine the dependency of abs(Z) on Omega and (parametrically) on Cvar.

Here the exact way of what I did, as also described in my post to Nigel:

1) Formulated the complex Z, using only symbolic variables (w=greek small omega) and exact numbers, as:

Code:

                         1
----------------------------------------------------------
 1          1                       1
---- + -------- + ----------------------------------------
 Ra     i*w*La              1               1
                       -------- + ------------------------
                        i*w*Cc             1
                                      ------- + i*w*Cr
                                       i*w*Lr


2) Formulated assumptions for all participating variables, as

assume(w>=0)
... etc.

3) Took the absolute value of that and simplified it. The symbolic result is about 18Kb.

4) It was then, that I subsituted the real values for Ra, La, Cc, and Lr, in the expectation to reduce the size of the expression and have quicker plots. If I put the symbolic expression in the plotter and store real in variables Ra, La, Cc and Lr, then the plot takes way too long. (Or the calc crashes.)

5) So, then I wanted to simplify the result with the real values because several multiplications of reals were not carried out yet. As a precaution (because of the assumptions still stored in w and Cr) I substituted the remaining symbolic variables w to Omega (=capital greek omega) and Cr to Cvar.

6) Then I tried to simplify that. It is here when the conversion to 0 happened. The quick examination of the sub-expression, that you refer to, was a test in my search for finding out what happens.

7) Then I also tried to expand the expression, which worked OK. But the result is unusable as the Prime complains about syntax. I can't take that into the plotter.

8) So I had to leave the expression as it was after substitution of real values but with no further simplifications, substitute X for Omega, store several values for Cvar, and see how the plot changes.


(10-06-2014 01:46 PM)parisse Wrote:  If you need to work with mixed data (float and symbols) you should use a command that uses numerical algorithms and not symbolic algorithms, e.g. fsolve for numeric equation solving, or polynomial operations in list form (poly1[coeffs]), etc.. Trying to run simplify is a bad idea: simplify and related command can not work properly with approx data (the reason is that simplifying fractions is implemented via the Euclidean gcd algorithm). If you really think you need to run simplify, rewriting floating point numbers as an exact fraction might be a solution, but only if the computation does not require too much ressources and in the end you will probably get something big and not useful.

Simplification of the expression which contains reals (but also unfinished multiplications of reals) would be nice but not necessary for the plot. It still takes a long time but not as long as storing values in the participating variables and putting the completely symbolical result into the plotter.

But you can't say what kind of result is useful for me, and what is not. Unfortunately all useful things in my business are big. Very big! And this is why I have to use such tools like the Prime. For equations with two variables and three powers I don't need any other tools than pencil and paper. It is the big ones for which I think of buing it for the staff.


(10-06-2014 01:46 PM)parisse Wrote:  I have no idea how mathematica handles that, because I don't have a license of mathematica (I will certainly not spend the money for that myself) and even if I had one, there is probably a Xcas way that would be as appropriate as the mma way.

Hmmm...

(10-06-2014 01:46 PM)parisse Wrote:  I can understand that you are frustated

I am not frustrated. I simply have to decide if I will buy Primes as mobile tools for the staff of my company, or if I will reject it. For that I need real consistent info.

(10-06-2014 01:46 PM)parisse Wrote:  not to find the right way on the Prime if you are used to mathematica, but you can not expect that Xcas or the Prime CAS will work the same way.

So, just one message before you told me:
(10-06-2014 01:46 PM)parisse Wrote:  A CAS can not work properly with approx data, it has to replace them by exact data, ....

Notice the usage of the indefinite article "a" in front of the word CAS, which implies more or less, that this is the behavior of any CAS in general, and that nothing else is possible. Now you tell me, more or less again, it is your CAS (and not a CAS in general) that works this way.

(10-06-2014 01:46 PM)parisse Wrote:  I can help you adapt, but I will not do that (remember it's on my free time) if your request is "it should be like in mma". If you don't want to adapt, then just stick with mma and goodbye!

I did not request it to be like Mathematica. I mentioned that it cannot be generally necessary for a CAS to work the way you explained before. Mathematica was but an example for negation of your statement, which now indeed yourself negate too by speaking about Xcas and not about a CAS.

So, thanks for the info and the support. You made up my decision. Prime is out of my company.

Ciao,

Nick
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: CAS simplifying non-zero expressions to 0 - kickniko - 10-06-2014 03:37 PM



User(s) browsing this thread: 1 Guest(s)