Implicit Plot with Trig

Hi guys,

I'm currently using Maple 10, however, I can't seem to plot this function:

>implicitplot(cos(x+y)=xy^2,x=-2..2,y=-2..2);

When I press enter, it just says:

"Error in implicit plot could not evaluate expression."

Anyone know?

gulliet's picture

xy is not x*y

Beware to insert an explicit multiplication sign between the variables x and y otherwise Maple believes you want the variable "xy" squared. The following will work as expected (add parentheses around x*y if you meant (x*y)^2 rather than x*(y^2)).

> with(plots, implicitplot);
> implicitplot(cos(x+y) = x*y^2, x = -2 .. 2, y = -2 .. 2);

97_impplot_1.jpeg

> with(plots, implicitplot);
> implicitplot(cos(x+y) = (x*y)^2, x = -2 .. 2, y = -2 .. 2);

97_impplot_2.jpeg

Regards,
--
Jean-Marc

Axel Vogt's picture

xy ...

Again somebody starting with Maple trapped by the standard interface? That's the way to find fans friends for products ...

gulliet's picture

Smoother plot with option gridrefine

Just an after thought. The second plot in my previous post looks jagged: you can get a smoother contour by setting the option "gridrefine" to a higher value than the default (zero). Below you can see an example with gridrefine set to two: the plot looks prettier.

with(plots, implicitplot); 
implicitplot(cos(x+y) = (x*y)^2, x = -2 .. 2, y = -2 .. 2, gridrefine = 2)

97_impplot_3.jpeg

Regards,
--
Jean-Marc

Just a note

When using commands from any package in Maple you do not have to specify the command in the with statement. All you need to do is specify which package you are using.

For example:

with(plots):
implicitplot(x^2+y^2 = 10, x = -10 .. 10, y = -10 .. 10)

gulliet's picture

Help page for inplicitplot needs some update

[UPDATED: Note that the documentation does not need to be updated. See Scott's reply below.]

Wow! I release I have been tricked by the first example of the help page for implicitplot. Indeed, I believed that implicitplot was also the name of a package and that one needed both the plots and implicitplot packages loaded to use the implicitplot command! Thanks for the clarification.

Regards,
--
Jean-Marc

See Scott's response below.

See Scott's response below.

Scott03's picture

Clarification

Jean-Marc, I think you may have missed something important here. the package that you are importing is the plots package. The implicitplot is a function within the plots package. To use this function you can either call it using the long form like one of the following:

plots[implicitplot](x^2+y^2 = 10, x = -10 .. 10, y = -10 .. 10);

or

plots:-implicitplot(x^2+y^2 = 10, x = -10 .. 10, y = -10 .. 10);

Or you can import the package. If you execute with(plots): you will import every function within the plots package. By executing with(plots,implicitplot): you are telling Maple to ONLY import the implicitplot function from the plots package. So the help page doesn't need to be changed at all since it is correct, just that it is different from a lot of other help pages where they import whole packages not just one function. This is useful if you are importing a package that would redefine functions that are default in Maple or a function you had defined.

See the ?with help page for more info.

Scott

Correct but different

It would help a lot to avoid confusions if the help pages were written in a uniform style: calling conventions, terminology, etc.

Also, I do not see in ?with a mention to subpackages. In particular, showing the difference in syntax between importing a command in a package and a subpackage.

gulliet's picture

Sorry, my mistake

Scott,

Many thanks for the information. I must admit that I had never bothered reading the help pages about "help", "with", or "using packages" before you picked my interest. I have just done that and learned quite a few things about commands such as ?, ??, ???, packages(), with() and unwith(), and I get finally a clear idea of how packages and commands are structured and related. I won't claim anymore that the documentation must be changed before checking carefully my understanding of the subject matter :-)

Best regards,
--
Jean-Marc

an equation

I have to solve the following equation

y^3-ay^2+y-ab=0 with  a=sqrt(3)..infinity and b=0..1. How could I study how many real solutions y are here?

with RootFinding[Parametric]

sherazat, your questions should be better in a new  thread.

In Maple 12 you can find the regions (cells) on the parametric space (a,b) with different number of real roots by:

with(RootFinding[Parametric]):
eq1 := y^3-a*y^2+y-a*b=0;
m:=CellDecomposition([eq1],[y],[a,b]);

The fastest way may be make plots with your constraints and a bit larger area for reference:

CellPlot(m,samplepoints=true,view=[-5..5,-2..2]);
CellPlot(m,samplepoints=true,view=[sqrt(3)..5,0..1]);  

Then you see that the cells with  a=sqrt(3)..infinity and b=0..1 are 6..9, and you get the number of real solutions within each of them by:

for i from 6 to 9 do
NumberOfSolutions(m)[i];
end do;

                                   [6, 1]
                                   [7, 3]
                                   [8, 1]
                                   [9, 1]

The borders of these regions are given by:

for i from 6 to 9 do
NumberOfSolutions(m)[i],CellDescription(m,i);
end do;

On the borders of the region 7 (blue) there are two real solutions (one double root).

The point a=sqrt(3),b=1/9 (where the borders join) is special as there is a triple root:

subs(a=sqrt(3),b=1/9,lhs(eq1));
factor(%);
                                                3
                              1  /        (1/2)\ 
                            - -- \-3 y + 3     / 
                              27                 

lemelinm's picture

One way

eq1 := y^3-a*y^2+y-a*b;

                                 3      2          
                         eq1 := y  - a y  + y - a b

Then, right-click to have the context menu and choose plot Builder -> Interactive Animation with 1 parameter and explore.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}