Post Reply 
Solve crash
04-03-2016, 10:04 PM
Post: #1
Solve crash
Prime calculator freezes and on IPad crashes when solving 48*x*(1+x)^60 -(1+x)^60 +1=0.

TI nSpire, WP 34s, CASIO f'x-9860gii, CASIO fx-991EX CLASSWIZ all solve the problem.

Problem from James Stewart Calculus 6E from 2008 page 334
Find all posts by this user
Quote this message in a reply
04-03-2016, 10:42 PM (This post was last modified: 04-04-2016 07:51 PM by compsystems.)
Post: #2
RE: Solve crash
csolve(48*x*(1+x)^60 -(1+x)^60 +1=0,x) or solve(48*x*(1+x)^60 -(1+x)^60 +1=0,x) also fail on computer software

WITH WOLFRAM ALPHA == (MATHEMATICA 10 CAS ON LINE)

https://www.wolframalpha.com/input/?i=so...2B1%3D0,x)

Real solutions:

x~=0.

x~=-1.92716

x~=0.0076286

Complex solutions:

x~=-1.92218-0.0961564 i

x~=-1.92218+0.0961564 i

x~=-1.90729-0.191289 i

x~=-1.90729+0.191289 i

Full roots

x = 0

x ~= -1.9271561199907936414881008

x ~= 0.0076286028099539777015656075

x ~= -1.9221771550742015188501602-0.0961563982433106026174076 i

x ~= -1.9221771550742015188501602+0.0961563982433106026174076 i

x ~= -1.9072929266183909109830631-0.1912887416721433309538790 i

x ~= -1.9072929266183909109830631+0.1912887416721433309538790 i

x ~= -1.8826608727866241589745145-0.2843838024774373729754946 i

x ~= -1.8826608727866241589745145+0.2843838024774373729754946 i

x ~= -1.8485415272854846877009969-0.3744498914066619354260234 i
Find all posts by this user
Quote this message in a reply
04-03-2016, 11:25 PM
Post: #3
RE: Solve crash
Interestingly, when solving for 1st derivative of the above equation to be zero, nSpire, Classpad 400 CAS's have no problem finding exact solutions of -1 and 1/224 (takes both platforms quite some time). Non CAS Classpad and 9860gii, on the other hand, cannot handle the almost flat f(x)=~1 for ~-1.7<x<-~.17. 9860gii found an incorrect answer of ~-1.39 for the graph view that I had chosen. CLASSWIZ, instead of reporting incorrect answer, reports that it can't solve it.
Find all posts by this user
Quote this message in a reply
04-03-2016, 11:52 PM
Post: #4
RE: Solve crash
Also, for same reason, non CAS WP 34s, after a long time, reports no root found.

Interestingly the Classpad 400 solved f(X)=0 finding X=-1, X=~.00763, reported more solutions may exist, did not see X=~-1.92

nSpire (using IPad version) on other hand found X=-1, X=~.00763, but reported an incorrect X=~-3.789!
Find all posts by this user
Quote this message in a reply
04-04-2016, 02:53 AM (This post was last modified: 04-04-2016 02:55 AM by toshk.)
Post: #5
RE: Solve crash
csolve(48*x*(1+x)^60.0 -(1+x)^60.0 +1=0,x)
adding .

ans.
{−1.92715611999,2.12052597703e−14,7.62860280995e−3}
Find all posts by this user
Quote this message in a reply
04-04-2016, 04:32 AM
Post: #6
RE: Solve crash
Perhaps oddly, Prime and IPad Prime successful with solving diff(f(x)) to equal 0, quickly finds exact solutions of -1, 1/244

Above and earlier posts all in CAS

Indeed, in HOME, if a decimal is entered after an integer in this problem, the Prime platforms do find the 3 decimal solution approximations with solve(

Without the decimal, even in HOME, the problem produces the freeze in the physical Prime, the crash on the iPad.

Great example, however, of the difficulty some problems present a non CAS when a function is very flat near an extremum, interesting to see a wrong answer vs can't find root response on various platforms.

Also interesting to see the nSpire produce an erroneous answer (-3.789 vs correct -1.92 for f(x) roots...

Fascinating behavior, and a reminder that these platforms are tools to a solution, but should not be used/viewed as a perfect black box in producing solutions.
Find all posts by this user
Quote this message in a reply
04-04-2016, 06:06 AM
Post: #7
RE: Solve crash
For polynomials, Giac provides the realroot command to isolate roots
Code:
realroot(48*x*(1+x)^60 -(1+x)^60 +1,1e-10)
returning intervals where there is exactly one root.
Unfortunately it does not seem to be available on the Prime.
Find all posts by this user
Quote this message in a reply
04-04-2016, 03:27 PM (This post was last modified: 04-04-2016 03:29 PM by DrD.)
Post: #8
RE: Solve crash
This seems to work for the reals: (Supplies a search interval)

solve(48*x*(1+x)^60 -(1+x)^60 +1=0,x=-2..2); // ==> [−1.92715611999,1.40998324127e−14,7.62860280994e−3]

x==0 (obvious by inspection)

-Dale-
Find all posts by this user
Quote this message in a reply
04-04-2016, 05:35 PM
Post: #9
RE: Solve crash
Hi,
All the solutions from Mathematica 10.

{{x -> 0.}, {x -> -1.92716},
{x -> 0.0076286}, {x -> -1.92218 - 0.0961564 I},
{x -> -1.92218 + 0.0961564 I}, {x -> -1.90729 - 0.191289 I},
{x -> -1.90729 + 0.191289 I}, {x -> -1.88266 - 0.284384 I},
{x -> -1.88266 + 0.284384 I}, {x -> -1.84854 - 0.37445 I},
{x -> -1.84854 + 0.37445 I}, {x -> -1.8053 - 0.460527 I},
{x -> -1.8053 + 0.460527 I}, {x -> -1.75338 - 0.541699 I},
{x -> -1.75338 + 0.541699 I}, {x -> -1.69335 - 0.617098 I},
{x -> -1.69335 + 0.617098 I}, {x -> -1.62583 - 0.685921 I},
{x -> -1.62583 + 0.685921 I}, {x -> -1.55153 - 0.747432 I},
{x -> -1.55153 + 0.747432 I}, {x -> -1.47125 - 0.800974 I},
{x -> -1.47125 + 0.800974 I}, {x -> -1.38584 - 0.845972 I},
{x -> -1.38584 + 0.845972 I}, {x -> -1.29618 - 0.881943 I},
{x -> -1.29618 + 0.881943 I}, {x -> -1.20324 - 0.908498 I},
{x -> -1.20324 + 0.908498 I}, {x -> -1.10798 - 0.925348 I},
{x -> -1.10798 + 0.925348 I}, {x -> -1.01141 - 0.932306 I},
{x -> -1.01141 + 0.932306 I}, {x -> -0.914559 - 0.929287 I},
{x -> -0.914559 + 0.929287 I}, {x -> -0.81843 - 0.916314 I},
{x -> -0.81843 + 0.916314 I}, {x -> -0.724034 - 0.893511 I},
{x -> -0.724034 + 0.893511 I}, {x -> -0.632357 - 0.861106 I},
{x -> -0.632357 + 0.861106 I}, {x -> -0.544352 - 0.819425 I},
{x -> -0.544352 + 0.819425 I}, {x -> -0.460927 - 0.76889 I},
{x -> -0.460927 + 0.76889 I}, {x -> -0.382932 - 0.710011 I},
{x -> -0.382932 + 0.710011 I}, {x -> -0.311149 - 0.643379 I},
{x -> -0.311149 + 0.643379 I}, {x -> -0.246268 - 0.569656 I},
{x -> -0.246268 + 0.569656 I}, {x -> -0.188877 - 0.489562 I},
{x -> -0.188877 + 0.489562 I}, {x -> -0.139413 - 0.403848 I},
{x -> -0.139413 + 0.403848 I}, {x -> -0.0980939 - 0.313257 I},
{x -> -0.0980939 + 0.313257 I}, {x -> -0.0647092 - 0.218398 I},
{x -> -0.0647092 + 0.218398 I}, {x -> -0.0377661 - 0.119235 I},
{x -> -0.0377661 + 0.119235 I}}

Ti-Nspire CX CAS with cSolve find many...

Marcel.
Find all posts by this user
Quote this message in a reply
04-04-2016, 07:00 PM (This post was last modified: 04-04-2016 07:03 PM by Han.)
Post: #10
RE: Solve crash
(04-03-2016 10:04 PM)lrdheat Wrote:  Prime calculator freezes and on IPad crashes when solving 48*x*(1+x)^60 -(1+x)^60 +1=0.

TI nSpire, WP 34s, CASIO f'x-9860gii, CASIO fx-991EX CLASSWIZ all solve the problem.

Problem from James Stewart Calculus 6E from 2008 page 334

I did not get a crash on my prime. In fact, it very quickly returned {0} as a solution. Remember that solve() attempts to give exact solutions. If you expect non-exact results, either specify an interval and/or use fsolve() (for floating point).

EDIT: Also, you can find the three roots using the plot app.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
04-04-2016, 07:53 PM (This post was last modified: 04-05-2016 01:53 AM by compsystems.)
Post: #11
RE: Solve crash
(04-04-2016 06:06 AM)parisse Wrote:  For polynomials, Giac provides the realroot command to isolate roots
Code:
realroot(48*x*(1+x)^60 -(1+x)^60 +1,1e-10)
returning intervals where there is exactly one root.
Unfortunately it does not seem to be available on the Prime.

Sorry for my bad English
The idea is that the CAS decides for itself, rather than the student look up the appropriate function to solve, it is to create a ALGEBRAIC EXPERT SYSTEM
Find all posts by this user
Quote this message in a reply
04-05-2016, 06:34 AM
Post: #12
RE: Solve crash
This works without user intervention with Xcas on the desktop:
Code:

s:=proot(p:=48*x*(1+x)^60 -(1+x)^60 +1);
(48*pcoeff(s)-symb2poly(p))./symb2poly(p);
point(s);
I'm afraid that multi-precision floats are required to get the roots with sufficient accuracy, compare with normal precision:
Code:

m:=companion(p);
point(diag(egvl(evalf(m))));
Find all posts by this user
Quote this message in a reply
04-05-2016, 11:22 AM (This post was last modified: 04-05-2016 11:50 AM by jebem.)
Post: #13
RE: Solve crash
(04-04-2016 07:00 PM)Han Wrote:  
(04-03-2016 10:04 PM)lrdheat Wrote:  Prime calculator freezes and on IPad crashes when solving 48*x*(1+x)^60 -(1+x)^60 +1=0.

TI nSpire, WP 34s, CASIO f'x-9860gii, CASIO fx-991EX CLASSWIZ all solve the problem.

Problem from James Stewart Calculus 6E from 2008 page 334

I did not get a crash on my prime. In fact, it very quickly returned {0} as a solution. Remember that solve() attempts to give exact solutions. If you expect non-exact results, either specify an interval and/or use fsolve() (for floating point).

EDIT: Also, you can find the three roots using the plot app.

Hi, Han,
Same here with my Physical Prime:

Typed in the equation using solve:
solve(48*x*(1+x)^60 -(1+x)^60 +1=0)
in CAS mode and it took about 2 to 3 seconds to return the result {0}.

Trying fsolve returns the results in about the same time:
solve(48*x*(1+x)^60 -(1+x)^60 +1=0)
returns 0

solve(48.*x*(1.+x)^60 -(1.+x)^60. +1.=0)
returns [-0.225800920842 -0.144166796312]

Trying csolve:
This puts the hourglass at the upper right corner for about 50 seconds:
csolve(48*x*(1+x)^60 -(1+x)^60 +1=0)
returns 0

and this returns the result in about 2 seconds:
csolve(48.*x*(1.+x)^60. -(1.+x)^60. +1.=0)
returns a HUGE solution listing in the form {a+b*i, ...} with 60 complex answers and the last the elements are just -0.225800920842, -0144166796312, 0.

I would say this is an impressive result.


My Prime setup is as follows:

About HP prime:
Software version: 2015 6 17 (8151)
Hardwrae Version: A
CAS Version: 1.1.2-11
Operating System: V0.037.526


CAS settings:
angle: degrees
Number format: Standard 12
Integers: Decimal Check
Simplify: Minimum
Exact: check
Complex: No check
Use sqrt: Check
Use i: No check
Principal: Check
Increasing: No check
Recursive Evaluation: 5
Recursive Replacement: 1
Recursive Function: 9
Epsilon: 0.000000000001
Probability: 1e-15
Newton: 40

HOME settings:
Angle measure: Degrees
Number Format: Standard
Digit Grouping: 123456.789
Entry: Textbook
Integers: Hex 32
Complex: a+b*i
Language: English

Jose Mesquita
RadioMuseum.org member

Find all posts by this user
Quote this message in a reply
04-05-2016, 12:36 PM
Post: #14
RE: Solve crash
(04-03-2016 10:04 PM)lrdheat Wrote:  Prime calculator freezes and on IPad crashes when solving 48*x*(1+x)^60 -(1+x)^60 +1=0.

TI nSpire, WP 34s, CASIO f'x-9860gii, CASIO fx-991EX CLASSWIZ all solve the problem.

Problem from James Stewart Calculus 6E from 2008 page 334

Can you be more specific:
What exactly command did you type?
Did you use a physical Prime?
What is your firmware version?
What about your specific settings?

Jose Mesquita
RadioMuseum.org member

Find all posts by this user
Quote this message in a reply
04-05-2016, 01:57 PM
Post: #15
RE: Solve crash
(04-03-2016 10:04 PM)lrdheat Wrote:  Prime calculator freezes and on IPad crashes when solving 48*x*(1+x)^60 -(1+x)^60 +1=0.

TI nSpire, WP 34s, CASIO f'x-9860gii, CASIO fx-991EX CLASSWIZ all solve the problem.

Problem from James Stewart Calculus 6E from 2008 page 334

CASIO fx-991EX CLASSWIZ has only a numerical solver, the Solve app of the Prime works about the same way and it finds the real solutions if you give the right initial values

initial value solution
0 0
1 7.629E-3
-2 -1.927
Find all posts by this user
Quote this message in a reply
04-05-2016, 02:36 PM
Post: #16
RE: Solve crash
Hi Jebem...

I don't understand your 2 solutions of ~-.22 and ~-.14. F(X) for those values is very close to 1.
Find all posts by this user
Quote this message in a reply
04-05-2016, 02:40 PM
Post: #17
RE: Solve crash
Hi Retoa,

Are you showing 1 and -2 as solutions. F(X) for those values are far from 0.
Find all posts by this user
Quote this message in a reply
04-05-2016, 03:23 PM
Post: #18
RE: Solve crash
As explained above, the polynomial rooter fails (because the precision is not sufficient to find the eigenvalues of the companion matrix numerically), that's why you get wrong roots with proot/fsolve/cfsolve on the Prime.
For polynomial equations with exact coefficients, realroot (in Xcas) will return isolation intervals (i.e. intervals where there is exactly one root), and you can give a precision parameter to refine the isolation interval. There are 3 real roots, you can check that on the Prime
Code:
ma:=maxnorm(coeff(p))+1; sturmab(p,-ma,ma);
Unfortunately, realroot is yet another command that was disabled on the Prime :-(
On the Prime, you can give an initial guess and the iterative method converges:
Code:
fsolve(48.*x*(1.+x)^60 -(1.+x)^60. +1.=0,x=1);
fsolve(48.*x*(1.+x)^60 -(1.+x)^60. +1.=0,x=-2)
Find all posts by this user
Quote this message in a reply
04-05-2016, 04:34 PM
Post: #19
RE: Solve crash
Perhaps the Prime and nSpire, when defaulting to decimal approximation in a solve case, should check that the candidate solutions equal the target solution to the number of significant digits that are chosen. The non CAS machines appear to do this successfully. The incorrect solutions on the TI and Prime could have been filtered out and not offered as an answer, or at least flagged where the user could peruse it further.
Find all posts by this user
Quote this message in a reply
04-05-2016, 06:10 PM (This post was last modified: 04-05-2016 06:13 PM by parisse.)
Post: #20
RE: Solve crash
proot can not do this kind of check, because the polynomial is expanded and therefore evaluation is very sensitive to loss of accuracy (cancellations). At some point (remember that we are talking of a polynomial of degree 61), the user is expected not to trust his calculator blindly.
As for the non CAS model, my understanding is that they do not solve like proot, they suceed in running an iterative method returning one root for a guess, like fsolve on the Prime.
Find all posts by this user
Quote this message in a reply
Post Reply 




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