Problem on displaying user defined function as output
|
11-01-2022, 06:24 AM
Post: #1
|
|||
|
|||
Problem on displaying user defined function as output
Hello! I am new to HP Prime and I start to explorer programming on HP Prime.
With the aid of Stirling numbers of the second kind, I could expand any polynomials in x in terms of the falling factorial (x^n) and the output as a list of the corresponding coefficients in ascending order. I had also implement the falling factorial as a function FALL(n). Here is the problem, any chance that I could refine the program such that the output could be like " 5+3*FALL(1)-2*FALL(2)" instead of a list {5 3 -2}. Many thanks! |
|||
11-02-2022, 08:20 PM
(This post was last modified: 11-02-2022 09:20 PM by ftneek.)
Post: #2
|
|||
|
|||
RE: Problem on displaying user defined function as output
Assuming the coefficients are stored in L0, you could try this:
Code:
It may need to be a cas program to give a symbolic result. Let me know if it works - neek |
|||
11-03-2022, 09:09 AM
Post: #3
|
|||
|
|||
RE: Problem on displaying user defined function as output
(11-02-2022 08:20 PM)ftneek Wrote: Assuming the coefficients are stored in L0, you could try this: Thank you for replying, I have tried similar idea but as FALL(n) has been implemented, it would directly simplify to some products like: FALL(4,x) ---->x*(x-1)*(x-2)*(x-3). So my idea is to use string manipulation, may be a bit clumsy as follows: Code:
The result is good, input: COEFF2FALL(x,{0,1,7,6,1}) output:"+1*FALL(1,x)+7*FALL(2,x)+6*FALL(3,x)+1*FALL(4,x)" The only downside is the additional quotation marks, expr is need to further use. I am not sure if the output could be produced without "". |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)