## 135 Reputation

11 years, 358 days

## Writing text using textprint=true withe ...

Maple 7

simplify_question.mws
Am trying to teach myself about lines and circles and inversion.  In the code below I'd like to put textt on the circles eg c1 to identify circle c1 etc.I'm more familiar with the textplot command & plottools, but want to use the draw command.  I've tried some options with the circle statement without success.
circle(c1,x^2+(y-2*R*cos(Pi/6))^2=R^2):  # 'ctext'=c1):

Is it possible to position text in a draw statement, similar to the textplot statement (that uses plot)?

I was amused by an idiosincracy of Maple 7.  The last line of my code uses the simplify command, yet I have had to resort to the simplification myself - (on the previous lines).   I was surprised and curious about this.  The Help section on simplify mentions several high power simplification procedures, yet fails to simplify a simple expression.  Any comments on this?

I'm interested in learning more about circle inversion and wondered if anyone knew of some elementary books on this.  Geometry Inversion was never taught to me at school, nor university, despite it being a topic over 1000 years old.

 > restart: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Test of geometry, radical axis. # # # # # # # # # # # # # # # # # # # # # # # # # # # # with(geometry): with(plots): _EnvHorizontalName := x: _EnvVerticalName := y: R:=5: circle(c1,x^2+(y-2*R*cos(Pi/6))^2=R^2):  # 'ctext'=c1): circle(c2,(x-R)^2+y^2=R^2): circle(c3,(x+R)^2+y^2=R^2): RadicalAxis(ra12,c1,c2): RadicalAxis(ra13,c1,c3): printf("Colors:  c1=red c2=blue  c3=gold\n"); printf("       ra12=magenta    ra23=grey\n"); t1:=textplot([0, 1.8*R, `Circle c1`]): draw([c1,c2, c3, ra12,ra13], axes=normal, color=[red, blue,gold, magenta,grey]); #draw([c1,c2, c3, ra12,ra13,t1], axes=normal, color=[red, blue,gold, magenta,grey, black], printtext=true); if AreTangent(c1,c2) then    printf("Circles c1 and c2 are tangential, (as they all are!)\n"); end if: testp:=Equation(ra12): #print(whattype(testp)); printf("Equation of radical axis for c1 & c2 is %A or\n", testp); simplify(Equation(ra12)/10); simplify(Equation(ra12));
 Warning, the name changecoords has been redefined Colors:  c1=red c2=blue  c3=gold        ra12=magenta    ra23=grey Circles c1 and c2 are tangential, (as they all are!) Equation of radical axis for c1 & c2 is 50+10*x-10*3^(1/2)*y = 0 or
 >

Maple 7

The program below works fine, but comes up with an error message: wrong number (or type) of parameters in function \$.  I'm confused as the Maple 7 Help on 'convert, bytes' the \$ symbol is omitted.  The program works fine: it is just a little disconcerting, as this is just the start of a general Wordwheel program.

The error seems to be related to the textplot command - but why?

 > restart: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Wordwheel program - intended to be general # # # # # # # # # # # # # # # # # # # # # # # # # # # # with(plots): with(plottools): #Number of letters, including the ? sign nolett:=7: #Angle of arc for each letter ang:=2*Pi/nolett: R:=5: # Draw the circle c:=circle([0,0], R, color=black): #Draw the lines for i from 0 to nolett-1 do   lin[i] := line([0,0], [R*cos(i*ang),R*sin(i*ang)], color=black,   linestyle=1): end do:  #i #Upper & lower case alphabets #s_L := convert( [\$97..122], 'bytes' ):   #a - z s_U := convert( [\$65..95], 'bytes' ):   #A-Z #s_L[25];    tp1:=textplot([1,2,s_U[6]],align={ABOVE,RIGHT}): plots[display](c,tp1, seq(lin[i], i=0..nolett-1), scaling=constrained, axes=none);
 Warning, the name changecoords has been redefined Warning, the name arrow has been redefined Error, wrong number (or type) of parameters in function \$
 >

## Unusual behaviour of line and textplot c...

Maple 7

The plots at the end of the following code output the lines when the textplot is absent - but with the textplot the lines are omitted.  Am puzzled as to why this is happening.  Square_areas.mws  Square_areas.txt

restart:
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Areas of portions of a square
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
with(plots):
with(plottools):
side:=6:A1:=16:A2:=20:A3:=32:
# Pick a point in the square: say (x1, y1)
poinC:=point([side/4,side/3]):
cpoin:=op(1,%):
x1:=cpoin[1];
y1:=cpoin[2];
lin[1]:=line([side/2,0],[x1,y1], color=black):
lin[2]:=line([0,side/2],cpoin, color=black):
lin[3]:=line([side/2,side],cpoin, color=black):
lin[4]:=line([side,side/2],cpoin, color=black):
#textA:=textplot([(cpoin[1]+side/2)/2,1,`A1`],align={ABOVE,RIGHT}):
#textA:=textplot([(1.5+side/2)/2,1,`A1`]):
tetA:=textplot([1,1.3,`A1`]):

squ:= polygon([[0,0], [0,side], [side,side],[side,0]], color=white):
# Plot without tetA - Lines are given
plots[display]({seq(lin[i],i=1..4),squ,poinC}, scaling=constrained,axes=normal);
# Plot with tetA - Lines are not given
plots[display]({seq(lin[i],i=1..4),squ,tetA,poinC}, scaling=constrained,axes=normal);
# Plot with tetA (placed  differently) - Lines are not given
plots[display]({squ,poinC,tetA,lin[1],lin[2],lin[3],lin[4]}, scaling=constrained,axes=normal);

## How to distinguish between real and comp...

Maple 7

solve_V_alfa.mws

I'm trying to solve two simultaneous equations for velocity, V, and angle of inclination, alfa, given the range, ranj and maximum height, H.  The solve part works fine, but gives me several unwanted complex solutions.  I was trying to put the solutions in a list so that I could access them.  The text below is rather verbose, but I've left comments in as a possible educational aid for people understanding expression sequences, and sets.

restart:
#interface(imaginaryunit, errorbreak=0, errorcursor=true, #labelling=false):
#with(SolveTools);

# Investigating sets and expression sequences
#S:={q, w,e}:
S:=7,2,5:
whattype(S);
L4:=convert(S,list): #Doesn't work for expression sequences
L4:=[S]; # this converts the expression sequence to a list, L4
L4[3]; # outputs 3rd element of L4 which is 5
# End of investigation

print(`Next part - solving two equations: Ranj and height H given`);
print(`To find angle of inclination, alfa, and velocity, V`);
g:=9.81:Ranj:=80:H:=15:
L:=solve({4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), Ranj*g-V*sin(2*alfa)},{V, alfa}): #::real}):
#L:=solve([4*V^2*cos(alfa)^2-g*Ranj^2/(Ranj*tan(alfa)-2*H), #Ranj*g-V*sin(2*alfa)],{V, alfa}): #::real}):
# ::real, alfa::real:
printf("L is of type %a", whattype(L));
#whattype(L);
#L2:=convert(L,list); #gives error message
L2:=[L]:
L2;
print(`Next: To distinguish between real and complex solutions`);
print(`Output in if statement is not working as expected.`);
#nops([L]);
for i from 1 to nops([L]) do
if type(L[i],complex(float)) then
#if type(L[i],nonreal) then
printf("Complex solution for i=%d\n",i);
else
printf("else part of if: i=%d\n",i);
print( L[i]);
end if;
end do; #for