Ronan

1247 Reputation

14 Badges

12 years, 249 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are replies submitted by Ronan

@acer Very Very well explained.

@acer   

Edit. I hadn't read your full reply.  The simpler version is understandable assuming the<>{} is checking for and empty set. 

Thank you. I am just trying to understand how the code works.
so the u->indets(rhs(u)  sets up the mapping

And(name,Not(constant),   detects constants like Pi and gamma etc

satisfies(nm->depends(rhs(u),nm))))<>{}   This I do not understand at all. 

	
selectremove(u->indets(rhs(u),
                       And(name,Not(constant),
                           satisfies(nm->depends(rhs(u),nm))))<>{}, C)

 

@acer Thank you. And the oracle is?. The expressions will be burried inside a proc in a package. Well probably have a couple of options on what to return/display. If all the parameters (a..f) are numeric/real then just eval the expression completly and return as a pair.

If  the parameters are algebraic eg a = 4+K*sqrt(7)   then return the large expression format elided.
I can check that as follows.

vals:=[a=18,b=sqrt(21)+5,c=-(7),d=-29,e=-37,f=-56]

`and`~(seq(is(rhs(vals[i]),real),i=1..nops(vals)))

@acer  That is powerful.
 I made your procedure also return the Qs for numerical evaluation.I could not get changing Q to another symbol to work because of this.

 I see what you mean about codegen:-optimize(eqn)

I managed to reduce the length of some of the Q expressions by factoring them. 

This will be great for displaying these expressions in the table layout and term elision you helped me with a couple of week ago.

Subs_Recur_ac.mw

@C_R So you mean change this

indets(eqn) minus indets(eqn,name);
subexpr:=map(op,%) minus indets(%,fraction):# remove of root terms - instead of filtering for `^`

indets(eqn,`^`) gives, which has  the a^2 ...e^2
 

{a^2, b^2, c^2, d^2, e^2, 1/(a*c - b^2/4), 1/(4*a*c - b^2)^2, (4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2, sqrt((a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2), sqrt(2*sqrt((a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2) + (-8*a*f + 2*d^2)*c^2 + (8*a^2*f - 2*a*d^2 + 2*a*e^2 + 2*b^2*f - 2*b*d*e)*c - 2*a^2*e^2 - 2*a*b^2*f + 2*a*b*d*e), sqrt(2*sqrt((a^2 - 2*a*c + b^2 + c^2)*(4*a*c*f - a*e^2 - b^2*f + b*d*e - c*d^2)^2) + (8*a*f - 2*d^2)*c^2 + (-8*a^2*f + 2*a*d^2 - 2*a*e^2 - 2*b^2*f + 2*b*d*e)*c + 2*a^2*e^2 + 2*a*b^2*f - 2*a*b*d*e)}

@C_R That is a good step forward. I'll apply this to some "beautiful" other expressions I have. 

I have been half thinking about setting up a procedure if I get a good all round handling.

Will let you know.

@acer How do you change the prompt. I presume you mean the >. Could you give a short exampple of commenting out the code with this method? I have used the (*.........*) in the VS coce editor.

If you are asking about Maple's default help database it not allowed.

From System, Help, About Help Databases

It states.

Types of Help Databases in Maple
  Read-only Help Databases
The shipped Maple .help files, which are located in the \lib directory of your Maple installation, are read-only files. This means that you cannot add to, remove from, or edit this collection of help pages.
 

@acer I realised afterwards the output was not elidied. But by changing the the value of L to 1800 the last equation displayed nicely. The last entry in the table was irritatingly spacing out. Maple often does that. Here is another screen shot that shows that effect. I wish Maple would handle this.

@segfault The question was asked last year sometime and apparently the setting of 10 files is coded into Maple and users can't change that. Sorry the backup suggestion was of no use to you. The MAS.bak files open ok. I sometimes use is when I am searching for something I did a few week ago and have no idea which folder I put it in etc.

@acer Ok, I have it working inside my package. It really makes the information readable. A couple of screen shots.

 

@acer That is wonderful. Works much nicer than I had hoped for

@acer Well, I decided to opt for a simple sollution. If the length exceeds 1200 characters just print "Long output".

I changed "values" in the proc to.

values:=<`if`(length(qqf)<=1200,qqf,cat("Long Output ",length(qqf)," characters")),`if`(length(q13)<=1200,q13,cat("Long Output ",length(q13)," characters")),`if`(length(q24)<=1200,q24,cat("Long Output ",length(q24)," characters"))>;

which displays as

Was there a windows update and could you restore to prior to that.

Have you installed any new software?

Can wipe and reinstall Maple?

Any other programs acting up?

Try running sfc /scannow   now in the command prompt as an administrator

Some procress on my problem. I found a proc somebody here wrote for me.  I searched but can't find the question now to credit the author. 
I have manually applied the concept to pairs of elements list wise as a test I haven't figured out how to get frontend working with multiple gcd's.

This could be applied to longer lists/vectors or even matrices.
I have just tested on one vector and it produced about a 30% reduction. I  would like to get this into an efficient procedure.
 


 

restart

#Fact written be a MaplePrimes member around 2017/18

fact := (expr::equation) -> frontend(gcd, [numer(lhs(expr)), numer(rhs(expr))])/frontend(gcd, [denom(lhs(expr)), denom(rhs(expr))])

proc (expr::equation) options operator, arrow; frontend(gcd, [numer(lhs(expr)), numer(rhs(expr))])/frontend(gcd, [denom(lhs(expr)), denom(rhs(expr))]) end proc

(1)

eq := (F + G)*R*sinh(x)/sqrt(W - 1) = 1/2*M*R^2*tan(x)*a/(R*sqrt(W - 1))

(F+G)*R*sinh(x)/(W-1)^(1/2) = (1/2)*M*R*tan(x)*a/(W-1)^(1/2)

(2)

fact(eq)

R/(W-1)^(1/2)

(3)

eq/fact(eq)

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

(4)

#Concept applied to a list of 2 elements

fact1 := (expr::list) -> frontend(gcd, [numer((expr[1])), numer((expr[2]))])/frontend(gcd, [denom((expr[1])), denom((expr[2]))])

proc (expr::list) options operator, arrow; frontend(gcd, [numer(expr[1]), numer(expr[2])])/frontend(gcd, [denom(expr[1]), denom(expr[2])]) end proc

(5)

 

 

 

l3:=Vector[column](3, [2*(((a^3 + a*b^2)*sqrt(b^2 + c^2) + 1/2*b^4 + 1/2*b^2*c^2 + 1/2*c^2*f^2 + 1/2*f^4)*sqrt(a^2 + b^2) + (-1/2*a^2*b^2 - 1/2*a^2*f^2 - 1/2*b^4 - 1/2*f^4)*sqrt(b^2 + c^2) - c*(b^2 + c^2)*(a^2 + b^2))/(sqrt(b^2 + c^2)*((-b^2 + f^2)*sqrt(a^2 + b^2) + (b^2 - f^2)*sqrt(b^2 + c^2) + (2*a^2 + 2*b^2)*(a - c))) - (-sqrt(a^2 + b^2)*sqrt(b^2 + c^2) + f^2)/sqrt(b^2 + c^2), -(2*sqrt(b^2 + c^2)*(-1/2*b^2*c + f^2*(a - 1/2*c))*sqrt(a^2 + b^2) + (b - f)*(b + f)*(a*f^2 + b^2*c + c^3 - c*f^2))/(sqrt(b^2 + c^2)*((-b^2 + f^2)*sqrt(a^2 + b^2) + (b^2 - f^2)*sqrt(b^2 + c^2) + (2*a^2 + 2*b^2)*(a - c))) + b^2/sqrt(a^2 + b^2), (2*sqrt(b^2 + c^2)*(-1/2*b^2*c + f^2*(a - 1/2*c))*sqrt(a^2 + b^2) + (b - f)*(b + f)*(a*f^2 + b^2*c + c^3 - c*f^2))*(-sqrt(a^2 + b^2)*sqrt(b^2 + c^2) + f^2)/((b^2 + c^2)*((-b^2 + f^2)*sqrt(a^2 + b^2) + (b^2 - f^2)*sqrt(b^2 + c^2) + (2*a^2 + 2*b^2)*(a - c))) - (2*((a^3 + a*b^2)*sqrt(b^2 + c^2) + 1/2*b^4 + 1/2*b^2*c^2 + 1/2*c^2*f^2 + 1/2*f^4)*sqrt(a^2 + b^2) + 2*(-1/2*a^2*b^2 - 1/2*a^2*f^2 - 1/2*b^4 - 1/2*f^4)*sqrt(b^2 + c^2) - 2*c*(b^2 + c^2)*(a^2 + b^2))*b^2/(sqrt(b^2 + c^2)*((-b^2 + f^2)*sqrt(a^2 + b^2) + (b^2 - f^2)*sqrt(b^2 + c^2) + (2*a^2 + 2*b^2)*(a - c))*sqrt(a^2 + b^2))])

Vector(3, {(1) = (2*((a^3+a*b^2)*sqrt(b^2+c^2)+(1/2)*b^4+(1/2)*b^2*c^2+(1/2)*c^2*f^2+(1/2)*f^4)*sqrt(a^2+b^2)+2*(-(1/2)*a^2*b^2-(1/2)*a^2*f^2-(1/2)*b^4-(1/2)*f^4)*sqrt(b^2+c^2)-2*c*(b^2+c^2)*(a^2+b^2))/(sqrt(b^2+c^2)*((-b^2+f^2)*sqrt(a^2+b^2)+(b^2-f^2)*sqrt(b^2+c^2)+(2*a^2+2*b^2)*(a-c)))-(-sqr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ector(3, {(1) = ((4*a-2*c)*(a^2+b^2)*sqrt(b^2+c^2)+2*b^4+2*b^2*c^2)*sqrt(a^2+b^2)-(2*a^2+2*b^2)*(a*f^2+b^2*c+b^2*sqrt(b^2+c^2)+c^3-c*f^2), (2) = (2*b-2*f)*(b+f)*((-(1/2)*sqrt(a^2+b^2)*b^2+(a-(1/2)*c)*(a^2+b^2))*sqrt(b^2+c^2)+(-(1/2)*b^2*c+(1/2)*(-a+c)*f^2-(1/2)*c^3)*sqrt(a^2+b^2)+(1/2)*b^4+(1/2)*b^2*c^2)/sqrt(a^2+b^2), (3) = -((((2*a-c)*b^6+(2*a*c^2-c^3+(-a^2-2*f^2)*c+2*a^3+2*a*f^2)*b^4+((-a^2-2*f^2)*c^3+(2*a^3+2*a*f^2)*c^2+(-a^2*f^2+2*f^4)*c+2*a^3*f^2-a*f^4)*b^2+(-a^2*f^2+f^4)*c^3+2*a^3*c^2*f^2-c*f^6+a*f^6)*sqrt(a^2+b^2)-b^2*(b^2+c^2)*(a^2*b^2+a^2*f^2+b^4+f^4))*sqrt(b^2+c^2)+(b^2+c^2)*(b^2*(b^4+b^2*c^2+c^2*f^2+f^4)*sqrt(a^2+b^2)+(-b^4*c+(a*f^2-c^3-c*f^2)*b^2-3*a*f^4-c^3*f^2+2*c*f^4)*(a^2+b^2)))/(sqrt(a^2+b^2)*(b^2+c^2))})

(9)

length(%)

1232

(10)

length(l3)

1812

(11)

length(simplify(l3))

1700

(12)

 


 

Download 2024-05-10_Q_Progress_on_Rescale_projective_vector.mw

3 4 5 6 7 8 9 Last Page 5 of 30