sursumCorda

882 Reputation

13 Badges

1 years, 91 days

MaplePrimes Activity


These are questions asked by sursumCorda

[I split this off from here into a separate question. dharr]

@dharr Thanks. For the second one, an output is . Is it possible to compel Maple to attempt to simplify the second algebraic number to a less complicated expression automatically? 
Its minimal polynomial can be computed. However, this is not so convenient for the specific purpose. Actually, I want something like this: 

evalA(-4*RootOf(_Z^3 - 3*_Z^2 - 10*_Z - 1)^2 + 19*RootOf(_Z^3 - 3*_Z^2 - 10*_Z - 1) + 3);
 = 
                       /  3        2           \
               5 RootOf\_Z  + 10 _Z  + 3 _Z - 1/

Mathematica has an additional function RootReduce to do so directly, but I cannot find such functionality in Maple.

Remark. A fairly complicated one: 

evalA(-45658*RootOf(37*_Z^6 - 382*_Z^5 + 1388*_Z^4 - 2188*_Z^3 + 1475*_Z^2 - 406*_Z + 37, index = 6)^5 + 417257*RootOf(37*_Z^6 - 382*_Z^5 + 1388*_Z^4 - 2188*_Z^3 + 1475*_Z^2 - 406*_Z + 37, index = 6)^4 - 1252087*RootOf(37*_Z^6 - 382*_Z^5 + 1388*_Z^4 - 2188*_Z^3 + 1475*_Z^2 - 406*_Z + 37, index = 6)^3 + 1463384*RootOf(37*_Z^6 - 382*_Z^5 + 1388*_Z^4 - 2188*_Z^3 + 1475*_Z^2 - 406*_Z + 37, index = 6)^2 - 558475*RootOf(37*_Z^6 - 382*_Z^5 + 1388*_Z^4 - 2188*_Z^3 + 1475*_Z^2 - 406*_Z + 37, index = 6) + 69230);
 = 
            /
17991 RootOf\

       6         5          4          3          2                
  37 _Z  - 406 _Z  + 1475 _Z  - 2188 _Z  + 1388 _Z  - 382 _Z + 37, 

           \
  index = 4/


 

The help page solve/details claims that solve(x^2-1,{x}, useassumptions) assuming x>0; is equivalent to solve({x^2-1, x>0},{x});. But the following example perplexes me again.

Considering a multi-variable polynomial: 

expr := 36*a^3*b^3+8*a^2*b^2*(9*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)+((a-b)^2-2*(a+b)+1)^2*(a+b+1)^5+a*b*((a-b)^2-2*(a+b)+1)*(17*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)^2: # assuming nonnegative

I intend to find the nonnegative real roots of it. 

solve({expr = 0, (a, b) >= ~ 0}, [a, b], allsolutions);
solve(expr = 0., [a, b], useassumptions, allsolutions) assuming (a, b) >= ~ 0;
solve({expr = 0., (a, b) >= ~ 0}, [a, b], allsolutions);

all return six solutions, but curiously, 

solve(expr = 0, [a, b], useassumptions, allsolutions) assuming (a, b) >= ~ 0;

only returns four solutions. Why???

In addition, as you can see, the first output (i.e., sol1) is thoroughly less meaningful. Can't it be more readable?? 
 

restart;

expr := 36*a^3*b^3+8*a^2*b^2*(9*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)+((a-b)^2-2*(a+b)+1)^2*(a+b+1)^5+a*b*((a-b)^2-2*(a+b)+1)*(17*(a+b+1)^2+4*(a*b+a+b))*(a+b+1)^2

sol1 := solve({`~`[`>=`](a, b, ` $`, 0), expr = 0}, [a, b], allsolutions) =
[[a = 0, b = 1], [a = 3^(1/2)-1, b = RootOf((-741235976922591048947725497133370413109846163676281959390560108171291511786260537194814187602376638467882392432305864*3^(1/2)+1283858372427879519277780718816094877088966867890478064541174875107114975191197490158346515516574907111238006510832897)*_Z^8+(542622395505288470330055221682724463979120704214196105150614766935823463404936952963532327914198268643355614078527033*3^(1/2)-939849558339893627565395772584016362240571623138367813630505449406759560167584121426096047290555008292409170786084695)*_Z^7+(27663303262730616171732317130828357033086591952430419833222950914496979987637185645479748907213281840470027913754446250*3^(1/2)-47914246756235321853987379290323009935074722268098020072540300747281044857411765919011355938402797296261231903185833860)*_Z^6+(-36848925451143075385294452437991667121840085487125852139251120381482252862356891660819456375517484560073220737684055360*3^(1/2)+63824211085697719773601999676355867125229886950052051470652732444578522019946850568834704346278726602905590979989005206)*_Z^5+(-361541600067355242269699717707379679953498397064818094940691654358197984962782803819129269994590941790029033835785321091*3^(1/2)+626208420366406708672813369852190896907780666621957659007533759258885959287096424079349105562785060297582745252447270847)*_Z^4+(469917886838763314544262854134623783463102170709338866937842556434901449696233730989733509809486602395675273592523379039*3^(1/2)-813921655390140293483357785790922432834508040979560342164969934794994487106266639300148834412459020073129881509269947685)*_Z^3+(2419091701164731099042357448446421888413075728672522494523180828886450053865285232431099171783692236478370266582727759022*3^(1/2)-4189989734585541679787610388006771626857619186946433018568920261866881451820006582050966407487366628715776067639375659568)*_Z^2+(-276526595929812923186277260098945143564039808175960075417091066631428638512893788855336862569832144723039829695578843580*3^(1/2)+478958113794505090444730274771005660986137994458744274847200001817421835204311147220572248669252963586284164359082018778)*_Z-2241557156236496486338463519192106892320755475146925672942972549523504139162741341146795559700763371271548957041603585449*3^(1/2)+3882490882671219790342097523842232566093205006918585285230133334462570311857306952032638288791685675699575851624588398080, index = real[4])], [a = 1, b = 0], [a = 1, b = 3^(1/2)-1], [a = 1, b = 1], [a = 1/2+(1/2)*3^(1/2), b = RootOf((3265859930834838622581170032695923790177759993209560990735389424723672715638564736*3^(1/2)+5656635330609319983539361351500545583607599001912359529744925502462343818424446992)*_Z^8+(12188355192278997228701701416892393163963118988331481511215704351909689249701576464*3^(1/2)+21110850453723155834822232801088862537748477983453402031696019279095705783764588192)*_Z^7+(-16329299654174193112905850163479618950888799966047804953676947123618363578192823680*3^(1/2)-28283176653046599917696806757502727918037995009561797648724627512311719092122234960)*_Z^6+(-47558033069228748234327710008167261759137556448974526775358049368769421447413364728*3^(1/2)-82372929583945025397186856831061837257531071444955446405553455730528485970812729160)*_Z^5+(71016746435016238932635448066739883738739336153617153345258159361269798232579788444*3^(1/2)+123004613013684064253013423478212462789515684702771043974383244940692061281906669908)*_Z^4+(-539074301591972734261861623983834399153978765971327430710378028630584341753429268*3^(1/2)-933704079412004867600664919608623045951401970711134655767859337789085046795723776)*_Z^3+(-8660811640968922793242100644402781523021841461481655906743406226105766029465794376*3^(1/2)-15000965796942156111966381948246207258139974790596863072851606476670777826354805396)*_Z^2+(-30769734905669303241874027457081560634086527346916553595415452889491557012102176442*3^(1/2)-53294744192044789072581100596045559567736905080848045509547703544202848750472876382)*_Z-3181857373467742490740890760219056890779274438575702235481520595135068397863751433*3^(1/2)-5511138633283790175605724430174371395924969988541134171865969654221197707640077992, index = real[4])]]
NULL

sol2 := `assuming`([solve(expr = 0., [a, b], useassumptions, allsolutions)], [`~`[`>=`](a, b, ` $`, 0)]) =
[[a = 0., b = 1.], [a = .7320508076, b = 1.000000000], [a = 1., b = 0.], [a = 1., b = .7320508076], [a = 1., b = 1.], [a = 1.366025404, b = 1.366025404]]
NULL

sol3 := solve({`~`[`>=`](a, b, ` $`, 0), expr = 0.}, [a, b], allsolutions) =
[[a = 0., b = 1.], [a = .7320508076, b = 1.000000000], [a = 1., b = 0.], [a = 1., b = .7320508076], [a = 1., b = 1.], [a = 1.366025404, b = 1.366025404]]
NULL

sol4 := `assuming`([solve(expr = 0, [a, b], useassumptions, allsolutions)], [`~`[`>=`](a, b, ` $`, 0)]) = [[a = 0, b = 1], [a = 1, b = 0], [a = 1, b = 3^(1/2)-1], [a = 1, b = 1]]NULL

_SolutionsMayBeLost;

_SolutionsMayBeLost

(1)

numelems(sol1), numelems(sol2), numelems(sol3), numelems(sol4) = 6, 6, 6, 4NULL

sol5 := [[a = 0, b = 1], [a = sqrt(3)-1, b = 1], [a = 1, b = 0], [a = 1, b = sqrt(3)-1], [a = 1, b = 1], [a = (sqrt(3)+1)*(1/2), b = (sqrt(3)+1)*(1/2)]]

Why did't solve({`~`[`>=`](a, b, ` $`, 0), expr = 0}, [a, b]) return sol5?

map2(evala@eval, expr, sol5);

[0, 0, 0, 0, 0, 0]

(2)

Error, (in type/algext) too many levels of recursion


 

Download solve_details.mw

The algebraic equation in four variables is: 

restart;
expr := (a^2 + b^2 + c^2 + d^2 - 4)*(a^2 + b^2 + c^2 + d^2) + 4*d*c*b*a - (a + b + c + d - 2)*(a + b + c + d) + 6:
solve(expr = 0, useassumptions, allsolutions) assuming nonnegative;

Unfortunately, I've been waiting for a long time, and I have no more time to wait; I have to interrupt the current session by hand. However, it appears that MMA can solve it within bearable time:

Did Maple miss something here?

The shortcut key Ctrl+Delete is used to clear a math region or delete a cell within a group, so I can delete some output manually. However, I find that there exists some long-standing functions like PrintTemporary and Monitor in Mathematica, which can be used to print intermediate values of variables temporarily (and dynamically, if possible). The term "temporarily" means that the printed output disappears at the end of a computation / when a computation is complete / when the evaluation finishes / before returning the result of an evaluation. For instance: 

(Note that certain operations require a front end.)

Is it possible to implement such functionalities in Maple? 

printf("%", [[]]);

Yeah, it is incompatible with the Maple syntax. But I don't know why this command actually causes a serious logic error here. Actually, this seems fairly trifling in my view. Can you produce it again? 

restart

printf("%", [[]]);

NULL

Download printfIssue.mws

First 14 15 16 17 18 Page 16 of 18