JAMET

325 Reputation

3 Badges

4 years, 286 days

MaplePrimes Activity


These are questions asked by JAMET

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)>

restart:
digits := 20;
unprotect(D);
G := 0.04361098108*x^2 + 0.4810001561*x*y + 1.326278064*y^2 - 0.7320831383*x - 2.656083763*y + 1 = 0
f := (x, y) -> lhs(G);
coeffs(f(x, y));
A, B, C, D, E, F := coeffs(f(x, y));
A := coeff(f(x, y), x, 2);
B := coeff(coeff(f(x, y), x), y);
C := coeff(f(x, y), y, 2);
D := coeff(coeff(f(x, y), x, 1), y, 0);
E := coeff(coeff(f(x, y), y, 1), x, 0);
F := tcoeff(f(x, y));
expand(B^2 - ((4*A) . C));
                          digits := 20

   f := proc (x, y) options operator, arrow; lhs(G) end proc

  1, -0.7320831383, 1.326278064, 0.04361098108, 0.4810001561, 

    -2.656083763


A, B, C, D, E, F := 1, -0.7320831383, 1.326278064, 0.04361098108, 

  0.4810001561, -2.656083763


                       A := 0.04361098108

                       B := 0.4810001561

                        C := 1.326278064

                       D := -0.7320831383

                       E := -2.656083763

                             F := 1

                               0.


with(geometry):
_EnvHorizontalName := 'x': _EnvVerticalName := 'y':
conic(co,f(x,y),[x,y]):
detail(co);
                 /                            
   GeometryDetail\["name of the object", co], 
   ["form of the object", ellipse2d], 
   ["center", [1.212351672 ^(10, 10), -2.198412833 ^(10, 9)]], 
   ["foci", [[2.424703344 ^(10, 10), -4.396825668 ^(10, 9)], 
   [0.1787052775, 0.9855002601]]], 
   ["length of the major axis", 2.464245740 ^(10, 10)], 
   ["length of the minor axis", 66579.62094], 
   [                                               2
   ["equation of the ellipse", 1. + 0.04361098108 x 
                                      2                 
    + 0.4810001561 x y + 1.326278064 y  - 0.7320831383 x
                       ]\ 
    - 2.656083763 y = 0]/;
   "_noterminate";

G is a parabola with B^2-4*A*C=0 or an ellipse ? A =1 or F=1 ? Thank you for youy answer. 

How to find the axis and focus of a parabola whose equation we know ? Thank you.

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