Ronan

1326 Reputation

14 Badges

13 years, 40 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

I have a whole lot of conditions to test on the signum of answers. This gets difficult to read so I am wondering could something like the following be done?

a, b, c, d := 1, -1, 1, -1;
if a, b, c, d = 1, 0, -1, -1 then
    print("foo");
end if;

The above obviously doesn't work. The reason I would like to do this is it would be simple to read the patterns of 1's and 0's.

Any ideas?

I was experimenting on and found coeff and degrees  do not work with algebraic type powers. So I set aboud dismanteling  a example polynomial. I certainly went around the houses doing this. I wanted to put the powers and coefficinets of x in an array.

I sure there must be a simpler way.

restart

NULLNULL

r := proc (x) options operator, arrow; a[0]+a[1]*x-a[2]*x^2+a[8]*x^(8/5)-a[h]*x^h+k*x^(-b/a) end proc

proc (x) options operator, arrow; a[0]+a[1]*x-a[2]*x^2+a[8]*x^(8/5)-a[h]*x^h+k*x^(-b/a) end proc

mnmls := [op(r(x))]

[a[0], a[1]*x, -a[2]*x^2, a[8]*x^(8/5), -a[h]*x^h, k*x^(-b/a)]

A := Array(1 .. 2, 1 .. nops(mnmls))

Array(%id = 36893489621187187044)

mnmls, x0 := selectremove(has, mnmls, x)

[a[1]*x, -a[2]*x^2, a[8]*x^(8/5), -a[h]*x^h, k*x^(-b/a)], [a[0]]

NULL

A[2, 1] := op(x0)

a[0]

coeff(r(x), x, 2)

Error, unable to compute coeff

coeffs(r(x), x)

Error, invalid arguments to coeffs

degree(mnmls[1], x)

1

degree(mnmls[4], x)

FAIL

degree(mnmls[5], x)

FAIL

indets(r(x))

{a, b, h, k, x, a[0], a[1], a[2], a[8], a[h], x^h, x^(-b/a), x^(8/5)}

bits := [seq([op(mnmls[i])], i = 1 .. nops(mnmls))]

[[a[1], x], [-1, a[2], x^2], [a[8], x^(8/5)], [-1, a[h], x^h], [k, x^(-b/a)]]

deeperbits := [seq(op(op(bits)[i]), i = 1 .. nops(bits))]

[a[1], x, -1, a[2], x^2, a[8], x^(8/5), -1, a[h], x^h, k, x^(-b/a)]

varpwrs, cofsl := selectremove(has, deeperbits, x)

[x, x^2, x^(8/5), x^h, x^(-b/a)], [a[1], -1, a[2], a[8], -1, a[h], k]

is(nops(vars) = nops(cofsl))

false

cofs := convert(cofsl, Array)

Array(%id = 36893489621220545228)

for i to numelems(cofs)-1 do if cofs[i] = -1 then cofs[i] := 0; cofs[i+1] := -cofs[i+1]; i = i+2 end if end do; cofs; cofs := remove[flatten](has, cofs, 0)

Array(%id = 36893489621220530764)

cofs

Array(%id = 36893489621220530764)

is(nops(vars) = numelems(cofs))

false

NULL

pwrs := `assuming`([simplify(`~`[log[x]](varpwrs))], [x > 0, a::'real', b::'real', h::'real'])

[1, 2, 8/5, h, -b/a]

A

Array(%id = 36893489621187187044)

for i to nops(mnmls) do A[1, i+1] := pwrs[i]; A[2, i+1] := cofs[i] end do; A

Array(%id = 36893489621187187044)

 

NULL


Download Q_11-9-22_monomial_powers_and_coeffs.mw

How should I handle the limit in the integration answe?. I don't see why it is necessary.

restart

_local(gamma)

p := `assuming`([proc (alpha) options operator, arrow; alpha^m end proc], [m]); LinearAlgebra:-Transpose(integer)

integer

q := `assuming`([proc (alpha) options operator, arrow; alpha^n end proc], [n]); LinearAlgebra:-Transpose(integer)

integer

Sa := eval((1/2)*(int(simplify(p(alpha)*(D(q))(alpha)), alpha = 0 .. 1)))

-(1/2)*(limit(alpha^(m+n), alpha = 0, right)-1)*n/(m+n)

s1 := eval((1/2)*(int(simplify(p(alpha)*(D(q))(alpha)), alpha)))

(1/2)*alpha^(m+n)*n/(m+n)

eval(s1, alpha = 1)-(eval(s1, alpha = 0))

(1/2)*n/(m+n)

NULL

Download Q_9-9-22_limit_in_integral.mw

I would like to insert a hyperling to a geogebra document but the hyperlink box deosn't appear to allow general files. Can this be done?

I have a long description that contains some Maple commands.
I dont want to use # as the lines dont show up when i use

Isee:=proc(a)
    interface(verboseproc = 3);
    printf("%P", eval(a));
end proc

The long description is. Any way around the problem?  

Test:=proc(A,B,C)  description  "Computes projective line through 2 projective points or intersert of 2 projective lines as a projective point or coincidence of piont  line   
 Does some checking on validity of inputs.   
Mobposn:- Global Variable, must = 1 or 3. 
Points are returned as <1,x,y> or <x,y,1>   
 Lines are returned as <z,x,y> or <x,y,z>,  
normalgpt :- Global Variable must be 0 or 1. 
Points with algecraic elements are not reduced to <1,x,y> or <x,y,1> if 0  
 Points are defined as row vectors and  lines as column `vectors"`; 

 print(A,B,A-C); 

 end proc;
First 14 15 16 17 18 19 20 Last Page 16 of 35