sipo94

10 Reputation

2 Badges

9 years, 218 days

MaplePrimes Activity


These are questions asked by sipo94

Hi, 

I have to plot in 2 different ways an ellipse that has been rotated in a plane. The equation of the ellipse is 

3x^2 - 3xy + 6y^2 -6x +7y =9

First of all I use the implicitplot which works great: 

restart;
f:=(x,y)->3*x^2-3*x*y+6*y^2-6*x+7*y-9;
with(plots):
implicitplot(f(x,y),x=-10..10,y=-10..10,numpoints=50000,scaling=constrained);

For the second method I really am not sure if what I'm doing is good. I tried with the plot3d, but it gave me some sort of weird shape, I really don't think it is what I am looking for. 

restart;
f:=(x,y)->3*x^2-3*x*y+6*y^2-6*x+7*y-9;
with(plots):
plot3d(f(x,y),x=-10..10,y=-10..10);

The I tried to reduce the equation to the form x^2/a^2 + y^2/b^2 = 1, but I could not, maybe because of the rotation. Still, I tried to take the ellipse function from Maple with some empirical numbers I just tried to create an ellipse looking like the first one. 

restart;
with(plottools):
with(plots):
a:=2.29:b:=1.38:x0:=0.8:y0:=-0.5:
elli:=ellipse([x0,y0],a,b,color=blue):
display(rotate(elli,0.4),scaling=constrained);
This time I get an ellipse similar to the first, but I don't really think it is legit to do it that way, in a sort of trial-and-error.

So I was wondering if there was another way like implicitplot to create the graph of that ellipse. 

Hi, I'm new to Maple and I have to produce a recursive procedure with the nomenclature Puis:=proc(X,n::integer) which calculates X^n with:

for n<0   ->   1/(X^(-n))

for n=0  ->   1

for n being an even integer   ->   X^(n/2) * X^(n/2)

for n being an odd integer   ->   X*X^(n-1)

The procedure I produced is:

Puis:=proc(X,n::integer)
option remember;
if n<0 then Puis(X,-n);
elif n=0 then 1;
elif rem(n,2,x)=0 then Puis(X,n);
else X*Puis(X,n-1);
end if;
end proc;

 

i don't have any eror up to this point, but when I try to evaluate, only Puis(4,0) works

Puis(4,-1);
Error, (in content) too many levels of recursion
Puis(4,0);
                               1
Puis(4,3);
Error, (in content) too many levels of recursion
Puis(4,4);
Error, (in content) too many levels of recursion

 

I was wondering what was wrong with my procedure, I changed the 1/(X^(-n)) with X^n and X^(n/2)*X^(n/2) for X^n because it is equivalent. I think I should put some sort of initial value to limit the recursion, but with that kind of function i really don't know how. I also tried with the X^(n/2)*X^(n/2) for the even numbers, but it says Puis expects its 2nd argument, n, to be of type integer, but received 1/2.

 

Page 1 of 1