JAMET

370 Reputation

4 Badges

6 years, 49 days

MaplePrimes Activity


These are questions asked by JAMET

restart;
with(plots);
with(plottools);
Vdot := proc (U, V)local i: add(U[i]*V[i], i = 1 .. 2) end proc:
dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end proc:
ngon := n -> local i; [seq([cos(2*Pi*i/n), sin(2*Pi*i/n)], i = 1 .. n)]:
theta := (2*Pi)/5;
poly := [seq([cos(k*theta), sin(k*theta)], k = 1 .. 5), datatype = float];
Ii := [0, 1/2]:
H := [-1/4, 0]:
r := dist(Ii, H):
theta := (2*Pi)/5:
p1 := pointplot([seq([cos(k*theta), sin(k*theta)], k = 0 .. 5)], symbol = solidcircle, color = red, symbolsize = 10):
p2 := textplot([seq([cos(k*theta), sin(k*theta), cat("M", k)], k = 0 .. 4)], align = ["above", "right"]):
cir1 := circle([0, 0], 1/2, color = green,dashdot:):
cir2 := circle([-1/4, 0], r, color = black):
cir3:=circle([0,0],1,color=red):
display([p1, p2, cir1, cir2, cir3,polygonplot(poly, thickness = 5, color = blue, transparency = 0.95)], axes = normal);
Why this error , Thank you.

Why this error message ?
with(geometry);
vartheta := (2*Pi)/17;
x || k := cos(k*theta);
y || k := sin(k*theta);
 xk := cos(k theta): yk := sin(k theta)
.M||k:=(point,x||k,y||k);
 with(plots):
Points := pointplot([seq(M || k, k = 1 .. 16)], symbol = solidcircle, color = red, symbolsize = 10):
Error, (in plots:-pointplot) cannot convert data to an Array of datatype float[8]; Thank you for your answer..

How to adapt this program C to Maple ? Thank you.

Sub Les_Vendredi_13()
Dim Annee As Integer
Dim Mois As Byte
Dim Cellule As String
Dim Compteur As Byte
Cellule = "B2"
Compteur = 1
Columns("B:B")
.ClearContents For Annee = 1949 To 2009
For Mois = 1 To 12 If Weekday(Mois & "/13/" & Annee) = 6
Then Range(Cellule).Offset(Compteur, 0) = "13-" & Format(Mois, "00") & "-" & Annee Compteur = Compteur + 1 End
If Next Mois Next Annee Range(Cellule).Offset(Compteur, 0) = "Nbre = " & Compteur - 1
End Sub

I try to sove the equation x^2-10*y^2=9 with tne procedure : 
genpellsolve := proc(D::posint, N::integer)
local t, u, L1, L2, sols, x, y;
if type(sqrt(D), integer) then error "D must be a nonsquare integer"; end
if; t, u := pellsolve(D); if 0 < N then L1 := 0;
L2 := floor(sqrt(1/2*N*(t - 1)/D)); elif N < 0 then L1 := ceil(sqrt(-N/D));
L2 := floor(sqrt(-1/2*N*(t + 1)/D)); else return {[0, 0]}; end if;
sols := {}; for y from L1 to L2 do x := sqrt(N + D*y^2);
if type(x, integer) then sols := sols union {[x, y]};
if (x^2 + D*y^2) mod N <> 0 or (2*x*y) mod N <> 0 then sols := sols union {[-x, y]};
end if;
end if;
end do;  return sols;
end proc:
This procedudure fails; I don't see why. Thank you for your help.

how to transform this program using LinearAlgebra instead of linalg  ?

restart;
with(plots);
unprotect(gamma, D);
interface(rtablesize = 10): _EnvHorizontalName := 'x': _EnvVerticalName := 'y':
f := (x, y) -> 4*x^2 + 4*y*x + y^2 - 8*x + 16*y - 17: (for instance)
NULL;
Fg := proc(P::polynom, v::set, V::list, N::list) 
local C, M, i, j; 
C := coeffs(f(x, y), v, M); seq(`if`(member(op(i, [M]), N, 'j'), op(j, V) = op(i, [C]), NULL), i = 1 .. nops([M])); end proc:
Fg(f(x, y), {x, y}, [A, B, C, D, E, F], [x^2, y*x, y^2, x, y, 1]):
assign(%);
Delta := -4*A*C + B^2:
var := [x, y]:
with(linalg):
AA := matrix([seq([seq(diff(f(x, y), var[i], var[j])/2, j = 1 .. 2)], i = 1 .. 2)]):
vp := sort([eigenvals(AA)]):
print(`Valeur propres de AA ` = vp):
DD := jordan(AA, 'P11'):
print(`Matrice diagonale semblable à AA:   DD` = evalm(DD)):
G := map(normalize, GramSchmidt([col(P11, 1 .. 2)])):
PP := map(simplify, concat(op(G))):
print(`Matrice de passage orthogonale:   PP` = evalm(PP)):
print(`Directions principales de la conique:`):
print(`I1 ` = col(PP, 1), ` J ` = col(PP, 2)):
alpha := 1/2*arctan(B/(A - C)):
print('alpha' = evalf(%)):                 

M1 := matrix(1, 2, [X, Y]):
M2 := matrix(2, 1, [X, Y]):
multiply(M1, AA, M2):
N := matrix(1, 2, [D, E]):
multiply(M1, AA, M2) + multiply(N, M2):
multiply(M1, transpose(PP), AA, PP, M2) + multiply(N, PP, M2):

NULL;
The parabola in the new base is Y`^2 =X*(8*sqrt(5))/5 , <sqrt(5), -2*sqrt(5)>, <sqrt(5), 2*sqrt(5)>

5 6 7 8 9 10 11 Last Page 7 of 24