Post Reply 
HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
11-27-2021, 04:42 PM (This post was last modified: 11-27-2021 05:39 PM by Gil.)
Post: #1
HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
How to simplify in a program such an algebraic expression '-(2.2*X^2-3.3*X-4.4+5*X^2)'
with real coefficients, suppressing the parentheses when they occurr, but with no string manipulation ?

I tried expand, collect, simplify, distrib, all with no success.

Thanks for your help.

Gil Campart
Find all posts by this user
Quote this message in a reply
11-27-2021, 07:00 PM
Post: #2
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
Since the entire expression is inside the parentheses with a negative sign, I don't know of any command that will do the algebraic manipulation required. EVAL will simplify it somewhat:

-(7.2*X^2+-3.3*X-4.4)
Find all posts by this user
Quote this message in a reply
11-27-2021, 07:13 PM (This post was last modified: 11-27-2021 07:43 PM by Gil.)
Post: #3
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
A pity in a way as it does not look very satisfactory for the mind or the eyes.
Find all posts by this user
Quote this message in a reply
11-28-2021, 08:10 AM (This post was last modified: 11-28-2021 08:12 AM by C.Ret.)
Post: #4
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
Hello,

Doesn't the COLCT command satisfy your need ?

I got no HP-50g, but on my HP-28S the '-(2.2*X^2-3.3*X-4.4+5*X^2)' expression is transformed into '4.4-7.2*X^2+3.3*X' by pressing the COLCT soft-key from the ALGBRA menu.

Why isn't '4.4-7.2*X^2+3.3*X' not OK ?
Find all posts by this user
Quote this message in a reply
11-28-2021, 09:30 PM
Post: #5
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
You may build the polynomial from scratch, with its coefs, [-7.2, 3.3, 4.4]

0
-7.2 'X' 2 [Y^X] * +
3.3  'X' 1 [Y^X] * +
4.4  'X' 0 [Y^X] * +

We get '-7.2*X^2 + 3.3*X + 4.4'
But, it may not worth the time to program it ...
Find all posts by this user
Quote this message in a reply
11-30-2021, 07:23 AM
Post: #6
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
First, I would use the command ->Q to set the calculator to exact mode and turn the expression's real numbers into integers. Then I would execute the command PARTFRAC. This seems to simplify the expression the way you want it. Except that the numbers are integers and not real numbers.

And if you use EVAL while in approx. mode to convert the fractions back to real numbers, the parentheses you want gone will reappear. I don't know how to manipulate this.

Lastly, I do not know if PARTFRAC will accomplish what you want every time. This is because I am not that knowledgeable about the 50g's CAS and I do not know exactly what it is you are accomplishing with your program.

Hope it helps figure out your problem.
Find all posts by this user
Quote this message in a reply
12-01-2021, 03:10 PM (This post was last modified: 12-01-2021 11:50 PM by Gil.)
Post: #7
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
Thanks for the answers, all interesting.

First, we have to suppose that we are inside a program, not knowing what kind of expression we will get, if there is or not somethings of the kind '-(...)'.

It might occurr a minus sign before (), or not.

Unfortunately, the COLCT command does not work on my HP50G EMU48 application.

Great idea with PARTFRAC, but the setting back to real, a disappointments result.

Regards,
Gil
Find all posts by this user
Quote this message in a reply
12-02-2021, 12:03 AM (This post was last modified: 12-02-2021 04:00 PM by ObiWanKenobi.)
Post: #8
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
Set the Flag -114 - for example with: -114 SF

Type the formula: '-(2.2*X^2-3.3*X-4.4+5*X^2)'
Press: EVAL

Result is: 4.4+3.3*X+-7.2X^2

Edit: removed the stuff with Incr Pow. Its the same flag and -114 should be enough.
Find all posts by this user
Quote this message in a reply
12-02-2021, 11:52 AM (This post was last modified: 12-02-2021 12:03 PM by Gil.)
Post: #9
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
I would never have thought of that!

Thanks and congratulations!

By the way, after your 2 instructions, EXPAND works now also instead of EVAL]
Find all posts by this user
Quote this message in a reply
12-02-2021, 03:58 PM
Post: #10
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
just found, that both are the same flag.
-114 SF
is enough.
Find all posts by this user
Quote this message in a reply
12-07-2021, 11:57 PM
Post: #11
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
Sorry to turn back to what seemed a solved question.

As I mentioned, the expression of the type
'-(...)' is unknown, it might appear in a program with -() or already been simplified.

With real coefficients for X,
we saw that -114 SF EVAL could remove the -().

How to remove on the HP49-HP50 the parentheses in
'-(100-1*X+7*X^2)'
or in '-(100.2-X+7*X^2)'
... without string manipulation?

It seems that all the suggested ideas have no effect.
Find all posts by this user
Quote this message in a reply
12-08-2021, 01:05 PM
Post: #12
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
(12-07-2021 11:57 PM)Gil Wrote:  How to remove on the HP49-HP50 the parentheses in
'-(100-1*X+7*X^2)'
or in '-(100.2-X+7*X^2)'
... without string manipulation?

It seems that all the suggested ideas have no effect.

Seems like FDISTRIB should be helpful here in some way. Perhaps in combination with flag settings and/or other steps? I've also noticed that in certain situations EXPAN seems to give more intuitive results than EXPAND, though I don't know the details of its process. It may be worth some experimentation as well.
Find all posts by this user
Quote this message in a reply
12-08-2021, 11:33 PM (This post was last modified: 12-08-2021 11:34 PM by ObiWanKenobi.)
Post: #13
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
interesting challenge :-P

FDISTRIB helps only in some situations.

ok, i see no simple solution. If you have only polynomials of the form
a0 + a1*x^1 + a2*x^3 ... an*x^n
you can extract the parameters a0 to an and then build the formula in the right way. I have three really old UserRPL programs which can do this task (never used for something like this). Let me know, if you are interested.
Find all posts by this user
Quote this message in a reply
12-09-2021, 01:09 AM
Post: #14
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
(12-08-2021 11:33 PM)ObiWanKenobi Wrote:  you can extract the parameters a0 to an and then build the formula in the right way. I have three really old UserRPL programs which can do this task (never used for something like this). Let me know, if you are interested.

Not sure if it is relevant to your question, but Albert Chan's program in this post seems to be an efficient way to extract the coefficients of a polynomial.
Find all posts by this user
Quote this message in a reply
12-09-2021, 09:59 AM (This post was last modified: 12-09-2021 10:03 AM by Gil.)
Post: #15
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
As already published in this forum, one possible "solution" that works well with string manipulation is my program
P.ARR.VER2(long version).

Or P.ARR.VER3 (short/compact version).


Attached File(s)
.doc  P.ARR.Ver2.Long.Doc (Size: 1.92 KB / Downloads: 3)
.doc  P.ARR.VER3.Doc (Size: 1,020 bytes / Downloads: 2)
Find all posts by this user
Quote this message in a reply
12-09-2021, 11:34 AM (This post was last modified: 12-09-2021 12:01 PM by ObiWanKenobi.)
Post: #16
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
(12-09-2021 01:09 AM)John Keith Wrote:  Not sure if it is relevant to your question, but Albert Chan's program in this post seems to be an efficient way to extract the coefficients of a polynomial.
Nice solution, but does not work in all situations because HORNER has an ugly issue.
Example:
1. 0. HORNER is not ok (wrong type)
1 0 HORNER is ok

note, that in the second case the number 1 is a "real integer" (type 28) and in the first case it is a "real number" (type 0).
Implementing a trap for this issue is needed and then it looses some performance.
Find all posts by this user
Quote this message in a reply
12-09-2021, 02:00 PM
Post: #17
RE: HP50: how to transform '-(2.2*X^2-3.3*X-4.4+5*X^2)' w/ no ()
(12-08-2021 11:33 PM)ObiWanKenobi Wrote:  ok, i see no simple solution...

One simple solution: install newRPL on your 50g. Type the equation and use AUTOSIMPLIFY. Works every time.
Find all posts by this user
Quote this message in a reply
Post Reply 




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