Ronan

175 Reputation

6 Badges

6 years, 223 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@Joe Riel That is nice proc and a big step towards the end goal. At this point, I am going to start a new question on reducing the equations as this one was primarily about plotting.

@Joe Riel Thank you. I have the same problem. I can't figure out how to get Maple to reduce (x^2 + y^2 -1)^2 to  x^2 + y^2 -1. I am trying to find a way to do this automatically. Do you have any ideas on how to?  It could be for example  (x^2 + y^2 -1)^6.  I just picked the circle equation as a representative example.

Another good example is; because it has no constant term.

(-27*x^2*y^2-27*y^4+4*x^3)^2

 

Christian Wolinski Very nice and powerful. I was just going to post a similar question. I have a couple of questions and a problem.

The code doesn't seem to need Y or am I missing something?

k doesn't match my variable x but it works with k?

I found a situation where it returns a squared version of the desired answer. Is there a way around this? 
 

restart

rtr := sqrt(54*x+6*sqrt(81*x^2-48*A+48*x))*(9*x+sqrt(81*x^2-48*A+48*x)-18*A)/(243*x+27*sqrt(81*x^2-48*A+48*x)+72)

(54*x+6*(81*x^2-48*A+48*x)^(1/2))^(1/2)*(9*x+(81*x^2-48*A+48*x)^(1/2)-18*A)/(243*x+27*(81*x^2-48*A+48*x)^(1/2)+72)

(1)

eq := y = rtr

y = (54*x+6*(81*x^2-48*A+48*x)^(1/2))^(1/2)*(9*x+(81*x^2-48*A+48*x)^(1/2)-18*A)/(243*x+27*(81*x^2-48*A+48*x)^(1/2)+72)

(2)

NULL

collect((`@`(evala, Norm))((lhs-rhs)(eq)), Y, proc (E) convert(E, parfrac, k, {I, sqrt(5)}); map(radnormal, %) end proc)

-A*x*y^2+x^2*y^2+y^4+(4/27)*A^3-(4/9)*A^2*x+(4/9)*A*x^2-(4/27)*x^3

(3)

"(=)"

-A*x*y^2+x^2*y^2+y^4+(4/27)*A^3-(4/9)*A^2*x+(4/9)*A*x^2-(4/27)*x^3

(4)

NULL

eq1 := y = simplify(rtr)

y = (54*x+6*(81*x^2-48*A+48*x)^(1/2))^(1/2)*(9*x+(81*x^2-48*A+48*x)^(1/2)-18*A)/(243*x+27*(81*x^2-48*A+48*x)^(1/2)+72)

(5)

Works without Y

collect((`@`(evala, Norm))((lhs-rhs)(eq1)), proc (E) convert(E, parfrac, k, {I, sqrt(5)}); map(radnormal, %) end proc)

-A*x*y^2+x^2*y^2+y^4+(4/27)*A^3-(4/9)*A^2*x+(4/9)*A*x^2-(4/27)*x^3

(6)

NULL

A := 0

0

(7)

eq2 := y = rtr

y = (54*x+6*(81*x^2+48*x)^(1/2))^(1/2)*(9*x+(81*x^2+48*x)^(1/2))/(243*x+27*(81*x^2+48*x)^(1/2)+72)

(8)

collect((`@`(evala, Norm))((lhs-rhs)(eq2)), Y, proc (E) convert(E, parfrac, k, {I, sqrt(5)}); map(radnormal, %) end proc)

x^2*y^2+y^4-(4/27)*x^3

(9)

This next one leaves the equation  squared    

eq3 := y = simplify(rtr)

y = (54*x+6*3^(1/2)*(27*x^2+16*x)^(1/2))^(1/2)*(3^(1/2)*(27*x^2+16*x)^(1/2)+9*x)/(27*3^(1/2)*(27*x^2+16*x)^(1/2)+243*x+72)

(10)

collect((`@`(evala, Norm))((lhs-rhs)(eq3)), Y, proc (E) convert(E, parfrac, k, {I, sqrt(5)}); map(radnormal, %) end proc)

(1/729)*(-27*x^2*y^2-27*y^4+4*x^3)^2

(11)

expand doesn't fix the problem.

eq4 := expand(eq3)

y = (54*x+6*3^(1/2)*(27*x^2+16*x)^(1/2))^(1/2)*3^(1/2)*(27*x^2+16*x)^(1/2)/(27*3^(1/2)*(27*x^2+16*x)^(1/2)+243*x+72)+9*(54*x+6*3^(1/2)*(27*x^2+16*x)^(1/2))^(1/2)*x/(27*3^(1/2)*(27*x^2+16*x)^(1/2)+243*x+72)

(12)

collect((`@`(evala, Norm))((lhs-rhs)(eq4)), Y, proc (E) convert(E, parfrac, k, {I, sqrt(5)}); map(radnormal, %) end proc)

(1/729)*(-27*x^2*y^2-27*y^4+4*x^3)^2

(13)

NULL


 

Download sometimes_not_full_reduction.mw

@acer That is great. So useful. Is there a way to extend the functionality to handle for example trig functions? I multiplied one side by sin(x) and the other by tan(x).

fact := proc (expr::equation) options operator, arrow; frontend(gcd, [numer(lhs(expr)), numer(rhs(expr))])/frontend(gcd, [denom(lhs(expr)), denom(rhs(expr))]) end proc;
 eq1 := F*R = (1/2)*M*R^2*(a/R); eq1/fact(eq1); 
eq2 := (F+G)*R*sin(x)/sqrt(W-1) = (1/2)*M*R^2*tan(x)*(a/(R*sqrt(W-1)));
 fact(eq2); eq2/fact(eq2)

(F+G)*sin(x) = (1/2)*M*tan(x)*a

 

@Carl Love I found that line of code here on Maple Primes as a stand alone way to truncate an equation.

map(select, proc (q) options operator, arrow; evalb(degree(q, b) <= odr) end proc, a)

I put it inside the  procedure. 

I see that yours works alone too.

select(proc (q) options operator, arrow; evalb(degree(q, [x, y]) <= 2) end proc, E2)

 

Thank you,

Both answers are execellent.

convert(eq, Sum, method = rational, include = powers)    @Kitonum That is some nice disassembly of the function in Addition 2. 

In Addition 1 I found using the inert form Sum and then setting u=v gives the correct evaluation of the limit.

I was originally trying to convert that expression automaticially to the sum for an abrtitary m. An example of something similar is  (a^n*b^m-a^m*b^n)/(a-b) which assuming n>m can be represented as a^m*b^m*(a^(n-m)-b^(n-m))/(a-b) but outside of actual numbers I can't get Maple to factor to that. That then evaluates to a^m*b^m*(Sum(u^(n-m-1-i)*v^i, i = 0 .. n-m-1)) .

These functions are rather elementry and I am surprised Maple doesn't seem handle this. 

In the original document I attached, I notice something odd with

convert(eq, Sum, method = rational, include = powers)

(Sum((1-v)^_k1*binomial(-m+_k1-1, _k1), _k1 = 0 .. m))*(Sum((-1)^_k1*(-1+u-v)^_k1, _k1 = 0 .. infinity))The second sum is from 0 to infinity. How could that be? 
Edit:- How do you do those nice grey sections where you display your code? 

@Kitonum  I like that. I haven't used 'limit' before. Will pay more attention to it in future. I am still interested in how to make Maple produce the sum. 

@tomleslie Yes I understand your point. In reality the matrix is being generated row by row and checked for the condition of M[i,1]<>M[1,1]. Does not necessarily happen though solimit loop to some upper value.

 or else it keeps running.

 

@vv Of course it would be probably hard to beat the Maple code. I was wondering if there was possibly some recursive approach.

@Kitonum  I managed to apply the concept to a telescoping series. Very Useful. 

sum(``(i^2-``((i-1)^2)), i = 1 .. 3) .. sum(``(i^2-``((i-1)^2)), i = -2+n .. n)

 

@Preben Alsholm 

I hit a problem too on a completly different issue.  All worked fine in Maple 2017.

Have a combined problem with typesetting=extended and Digits in Maple 2018.

Now what does work in typesetting =standard and Digits, this is not an issue.

With typ=extd. I was getting a incorrect 1 column in matrix. Some of the 1.0000s were 0.100000, The rest of the matrix was ok. I tries various values for Digits  no difference. I tried #Digits=15 lods ot stuff failed in the document. Removing Digits altogether produced allowed the document to run but still produced obvious errors in 1st column

Using win 10 64bit and Nvidia P2000
The new context panel is a great idea along with the plot builder.

There are some improvements that would make this really great.

Plot Builder needs to remember it’s settings. If the document is re executed the plot comes up empty and all settings are lost.

It would be good to combine Explore with Plot Builder so if you have functions like y=a x^2+b x +c you could set sliders for a,b,c.  The old plot builder (upto 2016) had this function.

At present Explore disappears when the document is re executed.

On the clickable math if you change the original equation the clickable math does not update.


                              

Edit....The below works and is lot simpler than what I was trying.  The fundamental problem is creating a procedure or module that has 2 stage inputs, data tables probably just add to that complexity.

 

@acer  Thank you. That is good.I simplified things by just using the matrix input pallet. And then using the the procedure to convert the matrix.


BiPolyNum := proc (N)
description "Creates Bi Polynumbers";
return ArrayTools:-Alias(N, [0 .. LinearAlgebra:-RowDimension(N)-1, 0 .. LinearAlgebra:-ColumnDimension(N)-1])
end proc;
                BiPolyNum := proc(N)  ...  end;

@acer Thank you. I have made some progress. I was using and array. Seems to cause the problem on slowness. Could be a bug.

I have it working outside of the procedure now. Still Struggling with the proc itself

I dont understand this statement "If I understand the question properly, then my Answer is as follows. The name of the unique Array/rtable/Matrix/Vector associated with a particular DataTable can be the argument to a procedure call, as can the unique string identity of a particular DataTable."

 Can you explain or show what that means?
 

restart

with(DocumentTools:-Components)

[Button, CheckBox, CodeEditRegion, ComboBox, DataTable, Dial, Label, ListBox, MathContainer, Meter, Microphone, Plot, RadioButton, RotaryGauge, Shortcut, Slider, Speaker, State, TextArea, ToggleButton, VideoPlayer, VolumeGauge]

(1)

with(DocumentTools:-Layout)

[Cell, Column, DocumentBlock, Equation, Font, Group, Image, InlinePlot, Input, Output, Row, Section, Table, Textfield, Title, Worksheet]

(2)

with(DocumentTools)

[AddIcon, AddPalette, AddPaletteEntry, Components, ContentToString, CreateTask, Do, GetDocumentProperty, GetProperty, InsertContent, InsertTask, Layout, RemovePalette, RemovePaletteEntry, RemoveTask, Retrieve, RunWorksheet, SetDocumentProperty, SetProperty, Tabulate]

(3)

NULL

ary := Matrix(4, 4)

Matrix(%id = 18446746160571978686)

(4)

 

 

NULL

DT := DataTable(identity = "DataTable0", variable = 'ary', rowheader, columnheader, columnnames = [beta^0, beta, beta^2, beta^3], rownames = [alpha^0, alpha, alpha^2, alpha^3])

xml := Worksheet(Group(Input(Textfield(DT))))

DocumentTools:-InsertContent(xml)

ary

Matrix(%id = 18446746160571978686)

(5)

PN1 := ArrayTools:-Reshape(convert(ary, Array), 0 .. 3, 0 .. 3)

Array(%id = 18446746160572000846)

(6)

Matrix(PN1)

Matrix(%id = 18446746160630366566)

(7)

PN1[0, 0]

8

(8)

``

ArrayDims(PN1)

0 .. 3, 0 .. 3

(9)

``

BiPolyNum := proc (a := 4, b := 4) local ary, mat, DT; description "Creates Bi Polynumbers"; mat := Matrix(a, b); DT := DataTable(identity = "DataTable1", variable = 'mat', rowheader, columnheader, columnnames = [1, beta, beta^2, beta^3], rownames = [1, alpha, alpha^2, alpha^3]); DocumentTools:-InsertContent(xml); return ArrayTools:-Reshape(convert(mat, Array), 0 .. a-1, 0 .. b-1) end proc

proc (a := 4, b := 4) local ary, mat, DT; description "Creates Bi Polynumbers"; mat := Matrix(a, b); DT := DocumentTools:-Components:-DataTable(identity = "DataTable1", variable = 'mat', rowheader, columnheader, columnnames = [1, beta, beta^2, beta^3], rownames = [1, alpha, alpha^2, alpha^3]); DocumentTools:-InsertContent(xml); return ArrayTools:-Reshape(convert(mat, Array), 0 .. a-1, 0 .. b-1) end proc

(10)

NULL

NULL

f := BiPolyNum()

Array(%id = 18446746160572026998)

(11)

f

Array(%id = 18446746160572026998)

(12)

Matrix(f)

Matrix(%id = 18446746160630355718)

(13)

``


 

Download DataTable_Experiment_rev_1.mw

this a further.

 

 

1 2 3 4 5 6 7 Last Page 1 of 10