Post Reply 
Existing CAS commands --> Prime discussion
06-26-2017, 06:40 PM (This post was last modified: 06-26-2017 07:23 PM by Tim Wessman.)
Post: #1
Existing CAS commands --> Prime discussion
First, let me explain that this is not a promise to add everything, nor a promise to add ANYTHING. It is simply a place for those interested in potentially getting commands that already exist in the CAS added to Prime, and discuss the merits and reasons behind adding a command. Having rational and reasoned discussion about commands will be the best way to encourage them to be added.

Quantity will not win out here. Quality and reason will. A 20 page post with pictures is not the way to explain best in any case I can possibly imagine.

Please, respond to my questions and educate my poor math skills as to why certain things need inclusion. I am listening and hoping to be wrong. I am especially weak when it comes to linear algebra/matrix type stuff as I stopped at the introduction level courses for my degree in university. Thanks!


Note, these are the rules and thought I personally tend to use when I look at adding a command:

  1. Just because a command exists does not mean Prime should have it. It needs a reason to be included. Existence alone is not that reason.
  2. Commands cannot be 3d specific (all that code required OpenGL behind the scenes for drawing)
  3. Commands cannnot be for file system access or read/write directly. We just don't support that.
  4. Commands cannot depend on code that is not in a license we can support. This generally means GPL or LGPL (no linked library support on hardware)
  5. Commands must fit within hardware limitations. Taking too much memory is problematic. We don't want different features in hardware vs phones and similar.
  6. Will the command impact any existing feature negatively?
  7. Is the command just too difficult to use or explain?
  8. Will the command duplicate existing functionality and not add to it? (synonyms, or a "different way of doing the same thing" aren't good reasons)
  9. Does the command add functionality that will benefit more then just 1 person?
  10. Does the command require modification (more then just "enable it") to the system in order to support? (if so, the bar to add it goes quite a bit higher)
  11. Is there already well written and FULLY explaining documentation? (often, only partial parts of the options are explained in the existing CAS documentation since features get added without documentation sometimes)


These thoughts are all things that go through my head when I look at adding or supporting something. It is a balancing act. Remember that EACH bit of text or documentation is multiplied by <number_of_languages> and thus even "small items" can result in large amount of additional translations. Small changes an ripple into large ones and impact much more then just a few minutes of my time. Developer time, testing time, documentation time, trade offs between things that we might *otherwise* be doing.... all have to be considered.


Without further ado, and starting from the items in the other thread, here is my thoughts/response to Joe's list. Note that I do have the full xcas english documentation and consult it regularly. It is quite out of date in some areas though by this point. :/

Items I immediately see an issue with:
Quote:
Airy_Ai - licensing problem in implementation (depends on LGPL library)
Airy_Bi - licensing problem in implementation in implementation
cloc2 - does not exist in my latest xcas?
clop2 - does not exist in my latest xcas?
conique_reduite - french, and not seeing it in my xcas install
ploc2 - not found in my xcas install
plop2 - not found in my xcas install
quadrique_reduite - french, and not found in my xcas install

Items I can see without much trouble might be useful:
Quote:adjoint_matrix - yes
bernoulli - yes
blockmatrix - yes
changebase - sure
colspace - yes
genpoly - yes
makevector - sure
isom - yes
rowspace - sure
tcoeff - yes, have lcoeff, need this

Commands in permutations/cycles stuff. These were deliberately left out of the CAS at first due to focus on more core thigns. I can probably see an argument to add them now: (any missing from this list?)
Quote:cycle2perm -
cycleinv -
cycles2permu -
is_cycle
is_permu
perminv
permu2cycles
permu2mat
permuorder

Items already turned on, or have the capability already:
Quote:fdistrib - Already in there, expand is a synonym
feuille - already in there, op is a synonym

Items turned on in source, means would be in next, if any, release comes in the future most likely:
Quote:chisquaret
kolmogorovd
kolmogorovt
multinomial
randvector
wilcoxonp
wilcoxons
wilcoxont

Here are items I have questions about or don't understand the purpose:
Quote:as_function_of - doesn't seem to function in my xcas install. as_function_of(b,a) returns an error

border - isn't this already handled by inserting a row? why need a second command here?
boxwhisker - does this provide any benefit over the existing stat capability? Seems less capable and not very useful on prime.
center2interval - not sure what this is useful for
combine - not quite sure how this does anything different from available rewriting commands... e.g. lncollect(ln(x)+2*ln(y)) is the same as collect(ln(x)+2*ln(y),ln) What benefit to having this command as its functionality is already there and more explicit in its use?

count_eq - all of this functionality seems to already be present in "count"???
count_inf - all of this functionality seems to already be present in "count"???
count_sup - all of this functionality seems to already be present in "count"???

det_minor - i don't see any benefit to having this in addition to just plain old "det". Seems to only be more efficient for small matrices...? Are we concerned about det in small matrix speed?

epsilon2zero - seems the cas already does this automatically and there is no way to stop it. (see complaints re such) What specific use would we have here for this in that case?
exp2list - This does not seem to do anything useful...?

groupermu -seems a bit esoteric. Really needed?
heugcd - gcd will do the same thing. Really need to be using a "different algorithm" when the final results should match?

is_pseudoprime - why? Is there a reason you'd want this over the current isPrime?
lll - i don't think I could support adding this command as defined. "LLL" is about the most non-descriptive, easy to accidentally call command name I've ever seen. :-? Is it |||, lll, or III? Font would make all the difference. Bernard and I are discussing a new name.

mRowAdd - seems a convenience function that doesn't add anything really. Only takes 2 operations to do the same thing I think. Really have a need for this?
newList - shortcut function to make a vector filled with zeros...? why need to add it?
ord - "Returns the ASCII code of a character or of the first character of a string." Why? Only use I can possibly think is for sorting purposes?
pari - not understanding what this gives us other then another way to do things like gcd?

psrgcd - same as gcd, just different algo? why would we need this?

rationalroot - not sure what this gets us?
realroot - not sure what this gets us?
reverse_rsolve - not sure how to interpret results or what this is getting us?
roots - what is this giving us over what we have now?
semi_augment - what do augment/semi_augment gain us over existing insertion commands for matrices? is this not possible?
simp2 - is this common enough we need a command to do it vs a two step command sequence?
simplex_reduce - maybe?
sommet - just putting [1] onto the expression will pull out the command. Need a specific command for this? 'sortd([3,2,1])'[1] returns 'sortd'
SortA - is there a reason to really have this since you can use sort() and specify > or <?
SortD - is there a reason to really have this since you can use sort() and specify > or <?, or just sort and then reverse?
split - not exactly sure the utility of this one...?
subsop - this is just basically replacing a row/col or item with something else. Really needed? We can do this already I think.
syst2mat - seems a bit esoteric.
unquote - i have no clue what this is doing or why it would be useful.
user_operator - have a few reservations on how this might interact with the system. I am not against it per say, but it may require some extra work past "turn it on". Not quite sure what "Delete" does (seems to not delete it for me?) or how "Unary" works. nor what "Binary" actually means in this case...

Other commands mentioned:
Quote:nop - this doesn't do anything, what would I document with resepct to "using" it?
evalb - "Since Xcas evaluates booleans automatically, evalb is only here for compatibility and is equivalent to eval" .... so why?
? as inline - doubtful to happen. We have to be conscious of basic users and ? : ; constructs don't really go well for new users. Also, this would require extensive changes to the 2d printing.
union and other inlined only commands can't be supported by the 2d printer without a lot of changes. I doubt the time for that would be usewhile. Hence, we push people to use the supported form.

Finally, items that fail to pass the "only Joe is interested in it" test: :-P
Quote:dfc <----------- :-(
dfc2f <----------- :-(

Joe really likes him some continued fractions. Yessireee that man do like them. Smile

Feel free to suggest any further items or commands you think should be added.

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-26-2017, 09:53 PM
Post: #2
RE: Existing CAS commands --> Prime discussion
(06-26-2017 06:40 PM)Tim Wessman Wrote:  Note, these are the rules and thought I personally tend to use when I look at adding a command:
  • ...Does the command add functionality that will benefit more then just 1 person?
Quote:...Finally, items that fail to pass the "only Joe is interested in it" test: :-P
Quote:dfc <----------- :-(
dfc2f <----------- :-(

Oh, phooey. Sad

Quote:Joe really likes him some continued fractions. Yessireee that man do like them. Smile

Yes, and I learned the bittersweet reason for that during a cross-country motorcycle trip with my dad in 1990:
Me: "Dad, some of these guys seem to live on their bikes. Why do some people like riding motorcycles so much?"
Dad: "Because everybody loves forever whatever they were thinking about at the pinnacle of their intellectual development." Big Grin

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-27-2017, 02:30 AM
Post: #3
RE: Existing CAS commands --> Prime discussion
I'm traveling so I cannot give a complete view but just immediately from the lists you have questions on.

simplex_reduce is key in classic optimization / Linear Programming. I would say any Optimization class will cover this at the 101 level. would be great to have this by default instead of programming it our selves (been there). Also great if it can perform the calculations staying in the rational (Z) domain if all coefficients are in Z (I think it can stay in Z in Xcas). Of course if has to work in the real domain (R) but that is a give.

is_pseudoprime is important in crypto. A network/internet/crypto security class could cover some of this. So useful in computer science/engineering.

You are right in that "zeros" and "czeros" covers rationalroot, crationalroot. realroot, i.e. rationalroot, crationalroot. realroot do not give us anything new.

Is Z/pZ and Z/pZ[x] implemented as in Xcas? Not sure (for vectors etc). Have not tested all.

dfc and dfc2f are helpful educationally in analytic theory, real and complex analysis so why not implement it?

Understand the licensing issue with Airy_Ai and Airy_Bi. Is there another way to get them?

Really happy to see that below are potential candidates - great additions to probability:

chisquaret
kolmogorovd
kolmogorovt
multinomial
randvector
wilcoxonp
wilcoxons
wilcoxont

Great that also that these are considered:

adjoint_matrix
bernoulli
blockmatrix
changebase
colspace
genpoly
makevector
isom
rowspace
tcoeff

Thanks!
Find all posts by this user
Quote this message in a reply
06-27-2017, 03:28 AM (This post was last modified: 06-28-2017 12:56 PM by compsystems.)
Post: #4
RE: Existing CAS commands --> Prime discussion
Hello, sorry for my bad English


TIM> These thoughts are all things that go through my head when I look at adding or supporting something. It is a balancing act. Remember that EACH bit of text or documentation is multiplied by <number_of_languages>

>> In the configuration menu, please add the option to remove languages after an update, to increase the free space.


-----
-----
1: nop cmd

A command I use frequently is ABEXPAND() available in the classpad calculator,

ABSEXPAND(abs(2-x)=1) -> [(2*x-1) = 1, (-2*x+1) = 1]

The code to emulate it in XCAS requires the NOP cmd

[subst((abs(2*x-1)) = 1,'abs','nop'), subst((abs(2*x-1)) = 1,'abs','neg')] -> [(2*x-1) = 1, (-2*x+1) = 1]

Apparently NOP is useless but if it is useful for it to replace for example a name of a function by an empty string

abs(2*x-1) -> nop(2*x-1) -> (2*x-1)

-----
----
2: evalb() cmd

There is an inconsistency between CAS and hp-prime

sqrt(2)>1.41 xcas returns TRUE
sqrt(2)>1.41 hp-prime cas mode returns 1 // =(
sqrt(2)>1.41 hp-prime home mode returns 1 // ok

In the symbolic environment (CAS) of the hp-prime the tests must be typed TRUE/FALSE (As a symbol or constant) and not its numerical equivalent 1/0

Evalb is very useful when you want to check equalities for example

evalb(5=5) -> 1 (true)
evalb(5=-5) -> 0 (false)

The Xcas eng documentation has errors (For this reason we must verify with examples) for example says:
http://www-fourier.ujf-grenoble.fr/~pari...html#htoc9
evalb is only here for compatibility and is equivalent to eval (false)

the translation into English is not reliable, please refer also to the original French version
http://www-fourier.ujf-grenoble.fr/~pari...ml#htoc201

eval(5=5) xcas returns 5=5
evalb(5=5) xcas returns 1



-----
-----
3: Eval cmd

This command requires more documentation
example

purge(r); purge(p); a:=1+i*r; r:=p+1;p:=-4;

a returns 1-3*i

eval(a) returns 1-3*i
eval(a,1) returns 1+(i)*r
eval(a,2) returns 1+(i)*(p+1)
eval(a,3) returns 1-3*i

FRN eval info
http://www-fourier.ujf-grenoble.fr/~pari...ml#htoc331
ENG
http://www-fourier.ujf-grenoble.fr/~pari...ml#htoc111

Among all we can form a collaboration group to improve documentation, improve examples, ...

Thanks

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
06-27-2017, 05:04 AM
Post: #5
RE: Existing CAS commands --> Prime discussion
Some comments:
as_function_of is more an internal function than something else, it is used by locus to build a function from a construction. For example in an Xcas session enter
a:=1;
b:=a*x+1;
as_function_of(b,a)

is_prime is the same as is_pseudoprime on the Prime, it links to PARI in Xcas.

c1oc2 and c1op2 are there in Xcas, it's a 1 not a l, read this as compose permutation as a cycle 1 with permutation as a cycle 2 or as a permutation 2.
Same for p1oc2 and p1op2

conique_reduite and quadrique_reduite have been translated to reduced_conic and reduced_quadric, the French keywords work only if you have selected French.

realroot is not the same functionnality as zeros or proot. zeros is an exact algorithm to find exact roots, proot is an approx algorithm to find approx roots, while realroot is an exact algorithm to find isolation interval for roots, it means you have a proof that there is 1 and exactly 1 root in the returned intervals.

makevector is not really useful, just put bracket on the sequence.

Z/pZ is available on the Prime, but you must enter %% instead of % in Xcas.

I don't want to make change to the parser that could have side effects, therefore I don't want to enable user_operator .

combine: it was added for maple compat.
SortA and SortD: added for TI compat.

count_eq, count_inf and count_sup were added at the request of teachers using Xcas, because they don't want to explain how to use count : count is indeed more elaborate since you must pass a function to a command
Find all posts by this user
Quote this message in a reply
06-27-2017, 01:25 PM
Post: #6
RE: Existing CAS commands --> Prime discussion
(06-27-2017 05:04 AM)parisse Wrote:  as_function_of is more an internal function than something else, it is used by locus to build a function from a construction. For example in an Xcas session enter
a:=1;
b:=a*x+1;
as_function_of(b,a)
Very useful for defining functions within a program

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
06-27-2017, 02:24 PM
Post: #7
RE: Existing CAS commands --> Prime discussion
(06-26-2017 06:40 PM)Tim Wessman Wrote:  ord - "Returns the ASCII code of a character or of the first character of a string." Why? Only use I can possibly think is for sorting purposes?

I use it to compare non-printable characters.

Code:
LOCAL X;
IF ord(X) == 12 THEN
:
:
END;

Tom L

DM42 SN: 00025
Find all posts by this user
Quote this message in a reply
06-27-2017, 06:59 PM
Post: #8
RE: Existing CAS commands --> Prime discussion
(06-27-2017 01:25 PM)compsystems Wrote:  
(06-27-2017 05:04 AM)parisse Wrote:  as_function_of is more an internal function than something else, it is used by locus to build a function from a construction. For example in an Xcas session enter
a:=1;
b:=a*x+1;
as_function_of(b,a)
Very useful for defining functions within a program
It will not work inside a program, it's designed for locus in the Xcas geometry screen, it is using an internal history mechanism. If you want to build a function from an expression, the right function is unapply.
Find all posts by this user
Quote this message in a reply
06-27-2017, 08:09 PM (This post was last modified: 06-28-2017 12:55 PM by compsystems.)
Post: #9
RE: Existing CAS commands --> Prime discussion
thanks BP.


Please improve the example of UNAPPLY cmd

g:= sin(x+1);
f:=unapply(g,x);
f(89); returns sin(90)

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
06-27-2017, 09:00 PM (This post was last modified: 06-27-2017 09:03 PM by Anders.)
Post: #10
RE: Existing CAS commands --> Prime discussion
(06-27-2017 05:04 AM)parisse Wrote:  Some comments:
as_function_of is more an internal function than something else, it is used by locus to build a function from a construction. For example in an Xcas session enter
a:=1;
b:=a*x+1;
as_function_of(b,a)

is_prime is the same as is_pseudoprime on the Prime, it links to PARI in Xcas.

c1oc2 and c1op2 are there in Xcas, it's a 1 not a l, read this as compose permutation as a cycle 1 with permutation as a cycle 2 or as a permutation 2.
Same for p1oc2 and p1op2

conique_reduite and quadrique_reduite have been translated to reduced_conic and reduced_quadric, the French keywords work only if you have selected French.

realroot is not the same functionnality as zeros or proot. zeros is an exact algorithm to find exact roots, proot is an approx algorithm to find approx roots, while realroot is an exact algorithm to find isolation interval for roots, it means you have a proof that there is 1 and exactly 1 root in the returned intervals.

makevector is not really useful, just put bracket on the sequence.

Z/pZ is available on the Prime, but you must enter %% instead of % in Xcas.

I don't want to make change to the parser that could have side effects, therefore I don't want to enable user_operator .

combine: it was added for maple compat.
SortA and SortD: added for TI compat.

count_eq, count_inf and count_sup were added at the request of teachers using Xcas, because they don't want to explain how to use count : count is indeed more elaborate since you must pass a function to a command

Sorry if I miss understand you above:

isprime on HP Prime return one value either true/false (if it is prime or not = 1/0 =)

is_pseudoprime in Xcas returns to values 2/1/0. 2 if it is true prime, 1 if it is a pseudo prime number otherwise it return 0.

So not sure what you mean....?

For very large numbers I still think is_pseudoprime is very valuable, or do you always calculate if every number is prime fully in isprime on HP Prime regardless on how large the number is?

I can see the value of realroot, complexroot and rationalroot for use with polynomial functions. I understand the distinction in how you arrive at the solution (algorithms). I can also see how this is useful in calculus (sign analysis of the function).

But then again, if I read you correctly and based on my own experience, zeros() always give you all roots exactly regardless. so... if you have all the roots exactly in Z if possible and also as expression of radicals if possible, if not then a decimal number within +/- epsilon error.

So what does realroot give us that zeros() does not. Same applies to complexroot() vs czeros().

Great that Z/pZ works 1:1 :-) also with vectors and matrices
Find all posts by this user
Quote this message in a reply
06-28-2017, 08:40 AM
Post: #11
RE: Existing CAS commands --> Prime discussion
isprime on the Prime returns 1 if the number is pseudoprime, it is not a proof of primality (except for "small" numbers) and there is nothing on the Prime to return a certificate of primality.

About roots: most of the time, proot will return accurate roots, but it may fail for very specific polynomials that have two roots almost identical (and zeros will almost never be able to return exact roots).
Classical example is Mignotte polynomial
mig(n,t):=x^n-((2^(t/2)-1)*x-1)^2
For example mig(257,14)==x^257-(127*x-1)^2 has two roots near 1/127.
realroot finds these roots with precision 1e-15 in about 0.03s on my computer, proot requires more than 6s (of course it also computes complex roots).
Find all posts by this user
Quote this message in a reply
07-01-2017, 07:27 PM
Post: #12
RE: Existing CAS commands --> Prime discussion
Here's a useful CAS "command" (syntax, really) that’s already implemented, but not documented or sensibly presented in CAS history:
    m1:=hilbert(99):;
where the emphasized bit suppresses the value returned by the assignment statement, and instead displays
    nodisp(m1:=hilbert(99))                             "Done"

in place of the special syntax. Trouble is, nodisp is not defined, so click-copying and evaluating the history entry
    nodisp(m1:=hilbert(99))
yields
    nodisp(m1:=hilbert(99))
                ⎛⎡  1    1/2    1/3    1/4    1/5    1/6    1/7    1/8    1/9    1/10
                ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯
    nodisp⎜ ⎢1/50 1/51  1/52  1/53  1/54  1/55  1/56  1/57  1/58  1/59
                ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯
                ⎝⎣1/99 1/100 1/101 1/102 1/103 1/104 1/105 1/106 1/107 1/108

except with nicer formatting, ninety-six additional rows in place of the ellipses, and preceded by a twenty-second or so delay while the 9,801-element matrix of fractions is formatted for display.

While defining
    nodisp(x) := when(type(x) == 0, "Done", "Done")
apparently fixes the re-evaluation problem, I don’t know enough about either Xcas or the Prime to be certain that this works in the general case*, and it's probably not a reasonable candidate for the “one, and preferably only one” way to do such a simple, fundamental thing as suppressing output of a function called only for its side effects.

Including the original ":;" syntax in both history and copy/paste seems like a reasonable solution (assuming, of course, that I haven’t overlooked an existing non-hack alternative!).

P.S.: The when expression in my definition shows up in textbook-format history (more or less) as written, but algebraically displays and click-copies as an (undocumented) C-style “p?q:r” conditional operator.

P.P.S.: How difficult would it be to provide, at least as an option, an actual history of verbatim, unevaluated input in the history, instead of a pretty-printed representation of the syntax tree after it has been accepted by the evaluator? Because the latter, current behavior has serious downsides that wouldn’t go away if it worked “correctly” in every case.

Most important example of why: valid input may nevertheless be mistaken, and it’s much harder to correct mistakes once original “nearly correct” input has been discarded in favor of considerably different “input”, whether or not the latter happens to be semantically equivalent to the original mistaken input.

It’s as if a psychotic teacher, instead of marking a student’s incorrect homework and returning it, redid all the work for the wrong answers from scratch in an entirely different way, shredded the original homework, then justified this behavior on the grounds that the “reimagined” errors were logically equivalent to the student’s original mistakes…

Less important example: if I’m using the CAS or Home screen to interactively prototype things that will ultimately be pasted into code, the current behavior forces me to either adopt to the history window’s (not necessarily stable between releases, and potentially subject to the whims of very machine-like implementation details) “coding style”, or else waste time either reformatting history or diligently copying everything I may want to save for reuse into the clipboard before evaluating it “just in case”, largely defeating the purpose input history exists to serve.

* In particular, I'm assuming without proof that the type function
  1. has no constraints on the type of its argument.
  2. never leaves its argument unevaluated.
  3. always returns values type-compatible with an equality test against zero**.

** While my nodisp definition seems to work as well without the equality test as with, I can’t find any documentation (HP or Xcas) suggesting that the automatic Boolean conversion of what appears to be any (exact or inexact, real or complex, rational or irrational) number is anything more than an implementation detail, so I include the equality test.
Find all posts by this user
Quote this message in a reply
07-02-2017, 05:10 AM
Post: #13
RE: Existing CAS commands --> Prime discussion
I understand your PPS, this is the reason why you don't have 2-d input by default in Xcas (you must select new expression). It's probably not available on the Prime because it's useful for advanced commandlines.
Find all posts by this user
Quote this message in a reply
07-02-2017, 07:08 PM (This post was last modified: 07-03-2017 01:34 PM by compsystems.)
Post: #14
RE: Existing xCAS commands --> Prime discussion
(MAKEMAT(0,30,30)):; [enter] returns "Done"

():; Very useful this postfix cmd, not show the result of the input.
But the equivalent cmd, as function nodisp() does not work on the hp-prime

nodisp(MAKEMAT(0,30,30)) [enter] returns
[[0,0,0...]]

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
07-03-2017, 02:15 PM
Post: #15
RE: Existing CAS commands --> Prime discussion
A command that must be in allow to change the configuration of flags in a code, because otherwise the AUTOMATION is lost, that is to the user, before executing the program or script please change the flag MANUALLY to NONE, MINIMUM, MAXIMUM

the cmd in Xcas for to change the simplify is autosimplify(arg) where arg is NOP for NONE, REGROUP for MINIMUM, SIMPLIFY for MAXIMUM

Xcas script
PHP Code:
1autosimplify(nop)

2:(a*x^2+b*x+c) = 0
a
*x^2+b*x+c=0

3
ans(-1)*4*a
(a*x^2+b*x+c)*4*a=0

4
ans(-1)+b^2
(a*x^2+b*x+c)*4*a+b^2=(b^2)

5expand(ans(-1))
4*a^2*x^2+4*a*b*x+b^2+4*a*c=(b^2)

6ans(-1)-4*a*c
4
*a^2*x^2+4*a*b*x+b^2+4*a*c-4*a*c=(b^2-4*a*c)

7simplify(ans(-1))
4*a^2*x^2+4*a*b*x+b^2=(-4*a*c+b^2)

8factor(ans(-1)) 
(
2*a*x+b)^2=(-4*a*c+b^2)

9(ans(-1))
abs(2*a*x+b)=((-4*a*c+b^2))

10: list[subst(ans(-1),'abs','nop'), subst(ans(-1),'abs','neg')] 
list[
2*a*x+b=((-4*a*c+b^2)),-2*a*x-b=((-4*a*c+b^2))]

11: list[ans(-1)[0]-bans(-1)[1]+b]
list[
2*a*x+b-b=((-4*a*c+b^2)-b),-2*a*x-b+b=((-4*a*c+b^2)+b)]

12expand(ans(-1))
list[
2*a*x=(-b+(b^2-4*a*c)),-2*a*x=(b+(b^2-4*a*c))]

13: list[ ans(-1)[0]/(2*a), ans(-1)[1]/(-2*a)] 
list[
2*a*x/(2*a)=((-b+(b^2-4*a*c))/(2*a)),2*a*x/(2*a)=(-(b+(b^2-4*a*c))/(2*a))]

14expand(ans(-1))
list[
x=(-b/(2*a)+((b^2-4*a*c))/(2*a)),x=(-b/(2*a)-((b^2-4*a*c))/(2*a))] 

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
07-10-2017, 08:46 AM
Post: #16
RE: Existing CAS commands --> Prime discussion
(06-28-2017 08:40 AM)parisse Wrote:  isprime on the Prime returns 1 if the number is pseudoprime, it is not a proof of primality (except for "small" numbers) and there is nothing on the Prime to return a certificate of primality.

About roots: most of the time, proot will return accurate roots, but it may fail for very specific polynomials that have two roots almost identical (and zeros will almost never be able to return exact roots).
Classical example is Mignotte polynomial
mig(n,t):=x^n-((2^(t/2)-1)*x-1)^2
For example mig(257,14)==x^257-(127*x-1)^2 has two roots near 1/127.
realroot finds these roots with precision 1e-15 in about 0.03s on my computer, proot requires more than 6s (of course it also computes complex roots).

ok got it. That means we would need both the isPrime and isPseudoprime functionality from Giac/Xcas to ensure we can make a distinction between true prime functionality and pseudo prime. This would also mean you need to allow the user to press stop to halt the calculator if isPrime take too long time to finish the true prime test. could be done as one function isPrime with a parameter to specific if you are looking for turn prime or pseudo prime (1/0).

Understand the distinction between the algoritms used for roots better now.
So we need to cover zeros, proot and realroot (including their complex root counterparts) to ensure we can cover all root corner cases, BUT we need to have really great documentation to explain when to use what algorithm to cover all cases.
Find all posts by this user
Quote this message in a reply
08-01-2017, 02:38 PM (This post was last modified: 08-16-2017 02:32 AM by compsystems.)
Post: #17
RE: Existing CAS commands --> Prime discussion
A demonstrative example of the importance of some commands that are required in hp-prime.

autosimplify()
evalb()
list2expr()

[Image: solver_xcas_step_by_step_ex0_io_image00.png]

[Image: solver_systemsOfEqs_image00.png]

http://www.hpcalc.org 20 years online
Visit this user's website Find all posts by this user
Quote this message in a reply
08-02-2017, 01:57 PM (This post was last modified: 08-02-2017 01:58 PM by Eddie W. Shore.)
Post: #18
RE: Existing CAS commands --> Prime discussion
Would the Fresnel functions S(x) and C(x) be a problem to implement? What about the elliptical integrals?

The function bernoulli and multinomial get my support.

I am going to look up kolmogorovd, kolmogorovt, wilcoxonp, wlicoxons, and wilcoxnt because I don't know what they are.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-02-2017, 05:35 PM
Post: #19
RE: Existing CAS commands --> Prime discussion
(08-02-2017 01:57 PM)Eddie W. Shore Wrote:  Would the Fresnel functions S(x) and C(x) be a problem to implement? What about the elliptical integrals?

The function bernoulli and multinomial get my support.

I am going to look up kolmogorovd, kolmogorovt, wilcoxonp, wlicoxons, and wilcoxnt because I don't know what they are.

Fresnel functions S(x) and C(x) was suggested before, but at the time parisse view was that the application was to small to warrant a full implementation in XCAS.

However, as S(x)=int(sin(x^2),x,0,x) and C(x)=int(cos(x^2),x,0,x) can be expressed as a function of the erf(x), which is implemented, you can actually do S(x) and C(x) today with some work of your own. See thread here: http://www.hpmuseum.org/forum/thread-588...52555.html.

I think in the end, parisse went ahead and implemented int(sin(x^2),x,0,x) and int(cos(x^2),x,0,x) in XCAS in terms of erf(x) for finite boundaries in definite integration case. So if you need S(x) you can use the method described in the thread and get it to work today. Of course it would be nice to have it natively implemented as S(x) and C(x) in PRIME hiding all the underlying transformations and so you do not have to do all this yourself.

All the others you mentioned get my vote too.
Find all posts by this user
Quote this message in a reply
08-05-2017, 06:40 AM
Post: #20
RE: Existing CAS commands --> Prime discussion
Well, I think the study of conics is very important in Geometry, and the HP Prime has no commands just as there are in the competition as the Classpad or Ti-nspire to analyze graphs of conics, in a parabola for example find The focus the vertex, point of symmetry; In an ellipse the focal distance, or the foci of the parabola or also the eccentricity, which is almost always denoted by the letter "e". And in the same way with other geometric curves.
Find all posts by this user
Quote this message in a reply
Post Reply 




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