Ronan

1172 Reputation

14 Badges

12 years, 186 days
East Grinstead, United Kingdom

MaplePrimes Activity


These are questions asked by Ronan

I trying to simplify expressions for lines so no higher order terms. factor and op seperate out what I need but how do I select the one with the variables in this case x,y. I cant depent on this always been the last one returned from the op command.

restart

 

vars=[x,y]

vars = [x, y]

(1)

k:=17

17

(2)

expr:=-2*sqrt(118)*(((-4*x + y + 51/32)*sqrt(k) + (k*x)/4 - (51*y)/4 + 153/32)*sqrt(-4012 + 1003*sqrt(k)) + ((x + 4*y)*sqrt(k) - (85*x)/4 - (17*y)/4)*sqrt(4012 + 1003*sqrt(k)))*k^(1/4)/(17051*(-1 + sqrt(k)))

-2*118^(1/2)*(((-4*x+y+51/32)*17^(1/2)+(17/4)*x-(51/4)*y+153/32)*(-4012+1003*17^(1/2))^(1/2)+((x+4*y)*17^(1/2)-(85/4)*x-(17/4)*y)*(4012+1003*17^(1/2))^(1/2))*17^(1/4)/(-17051+17051*17^(1/2))

(3)

indets(expr)

{x, y}

(4)

factor(expr)

(1/64192)*(-4012+1003*17^(1/2))^(1/2)*118^(1/2)*17^(1/4)*(17^(1/2)+5)*(40*x-24*y-3)

(5)

op(factor(expr))

1/64192, (-4012+1003*17^(1/2))^(1/2), 118^(1/2), 17^(1/4), 17^(1/2)+5, 40*x-24*y-3

(6)

select(has,vars, factor(expr))

select(has,vars, op(factor(expr)))

Error, invalid input: has expects 2 arguments, but received 7

 
 

 

Download 2024-09-11_Has_Select_Question.mw

I need to automatically extend or truncate a colour list to suit number of points in plottools:-point plot.
extending the list the colour sequence could be repeated or if the is too awkard just add black.
I can't figure out how to select the list of colours to put into a new list to modify.

This will be inside a plotting procedure.

restart

with(ListTools)

[BinaryPlace, BinarySearch, Categorize, Classify, Collect, Deal, DotProduct, Enumerate, FindMaximalElement, FindMinimalElement, FindRepetitions, Flatten, FlattenOnce, Group, Interleave, InversePermutation, Join, JoinSequence, LengthSplit, MakeUnique, Occurrences, Pad, PartialSums, Reverse, Rotate, Search, SearchAll, SelectFirst, SelectLast, Slice, Sorted, Split, Transpose, Unpermute]

(1)

L:=[[1,2],[3,4],[-5,6],[-3,-2]]

[[1, 2], [3, 4], [-5, 6], [-3, -2]]

(2)

qty:=nops(L)

4

(3)

styles:=[symbol=solidcircle,colour=[red,green,blue,orange],symbolsize=12]

[symbol = solidcircle, colour = [red, green, blue, orange], symbolsize = 12]

(4)

 

plots:-display(plottools:-point(L,styles[]))

 

#Need to extend or truncate the list of colours to match the number of points
#styles can be copied to styles 1,2 etc
#the extended list would be a repeatition of the colour sequence given
#would need to look for color or colour;

has(styles,colour); #how to select colour our into a seperate list?

true

(5)

#too few point for the colours;
L1:=[[1,2],[3,4],[-5,6]]

[[1, 2], [3, 4], [-5, 6]]

(6)

plots:-display(plottools:-point(L1,styles[]))

Error, (in Plot:-Structure:-Points) number of colors must match number of points

 

#too many point for the colours;
L2:=[[1,2],[3,4],[-5,6],[-3,-2],[6-1],[0,1]]

[[1, 2], [3, 4], [-5, 6], [-3, -2], [5], [0, 1]]

(7)

plots:-display(plottools:-point(L2,styles[]))

Error, (in plottools:-point) incorrect arguments for creating points structure, try providing the dimension option

 
 

 

Download 2024-09-06_Q_Extend_or_Truncate_List_of_Colours.mw

If there any way to make text  parallel to a line in textplot3d.

display(line([1,2,3],[4,5,-2],linestyle=longdash),
        point([2.5,3.5,0.5]),
        textplot3d([2.5,3.5,0.5,"not aligned"]))

This problem began about 3 nights ago.

When I load the subpackage UHG to RationalTrigonometry no warning.

When I rerun the worksheet warnings appear. If I put in arestart and reload the packages no warning. The problem only occurs with the sub packageUHG. The RationalTrigonometry package also has a few aliases.

Screen shot of one rerun  then added restart.

I am trying to check if the inputs are a pair of row or column matrices. How should I do that? I have tried type but no success.


 

restart

 

TestDim:=proc(p1::{Matrix(1,3),Matrix(3,1)},p2::{Matrix(1,3),Matrix(3,1)},prnt::boolean:=Prntmsg)
description "Midpoints, Bilines";
uses RationalTrigonometry;
local x1, y1, z1, x2, y2, z2,m1,m2,xpsn , ypsn,zpsn ;

if [Dimension(p1)]=[1,3] and [Dimension(p2)]=[1,3] then  
      m1:= Vector[row](3);
      m2:= Vector[row](3);
      print([1,3]);
  elif [Dimension(p1)]=[3,1]and [Dimension(p2)]=[3,1] then
      m1:= Vector[column](3);
      m2:= Vector[column](3);
       print([3,1]);
 else
      ERROR(p1,p2, `must both be row or column matrices`);
end if;
end proc

proc (p1::{Matrix(1, 3), Matrix(3, 1)}, p2::{Matrix(1, 3), Matrix(3, 1)}, prnt::boolean := Prntmsg) local x1, y1, z1, x2, y2, z2, m1, m2, xpsn, ypsn, zpsn; description "Midpoints, Bilines"; if [Dimension(p1)] = [1, 3] and [Dimension(p2)] = [1, 3] then m1 := Vector[row](3); m2 := Vector[row](3); print([1, 3]) elif [Dimension(p1)] = [3, 1] and [Dimension(p2)] = [3, 1] then m1 := Vector[column](3); m2 := Vector[column](3); print([3, 1]) end if end proc

(1)

f:=<<a|b|c>>;
g:=<<d|e|h>>

f := Matrix(1, 3, {(1, 1) = a, (1, 2) = b, (1, 3) = c})

 

g := Matrix(1, 3, {(1, 1) = d, (1, 2) = e, (1, 3) = h})

(2)

TestDim(f,g)

 


 

Download 2024-08-18_Test_Matrix_Dimension.mw

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