0
$\begingroup$

I am having trouble running this code:

Needs["GraphicsColors"];

u[x_, y_] = FullSimplify[ComplexExpand[Re[g[x + iy]], TargetFunctions -> {Im, Re}]];

v[x_, y_] = FullSimplify[ComplexExpand[Im[g[x + iy]], TargetFunctions -> {Im, Re}]];

w[x_, y_] = FullSimplify[ComplexExpand[Abs[g[x + iy]], TargetFunctions -> {Im, Re}]];

Plot3D[u[x, y], {x, -3, 3}, {y, -3, 3},
  PlotPoints -> {41, 41}, 
  PlotRange -> {{-3, 3}, {-3, 3}, {-0.05, 0.4}},
  ClipFill \[RightArrow] None, AxesLabel -> {"x", "y", ""}, 
  ColorFunction -> Hue]; 

Print["u[x,y]=", Re[f[x + iy]]];

Print["=", u[x, y]];

When I evaluate the code above, I get the following message:

Get::noopen: "Cannot open \!\(\"GraphicsColors\"\). "

What is wrong with this code?

$\endgroup$
5
  • $\begingroup$ Graphics`Colors`​ is now a deprecated package. What functions do you need in there? $\endgroup$ Oct 13, 2015 at 7:11
  • $\begingroup$ To be honest, I need to do what is shown: goo.gl/fHvMAb. $\endgroup$ Oct 13, 2015 at 8:30
  • $\begingroup$ Related: 39386. $\endgroup$
    – dionys
    Oct 13, 2015 at 9:00
  • $\begingroup$ At the time those pages you referred to were written, you did need to load a package to use Hue[] and the named colors; they have been built-in for quite a while, as noted in dionys's answer. $\endgroup$ Oct 13, 2015 at 9:13
  • $\begingroup$ Thank you very much for the help! $\endgroup$ Oct 13, 2015 at 21:15

1 Answer 1

3
$\begingroup$

The message Get::noopen is a warning indicating that your package was not loaded.

This particular package was useful in version 5.2 and earlier, but has been superseded by the functionality built into ColorData introduced in version 6. For newer versions of Mathematica the colors in the code you're using are available without loading anything extra.

Incidentally, the old colors are still accessible:

ColorData["Legacy", "ColorNames"]
(*{"AliceBlue", "AlizarinCrimson", ... ,"YellowOchre", "Zinc"}*)

ColorData["Legacy", "Zinc"] // FullForm
(*RGBColor[0.990005`,0.97`,1.`]*)

Module[{g, u}, g[z_] := 1/(5 z^4 + 26 z^2 + 5);
 u[x_, y_] := Re@g[x + I y];
 Plot3D[u[x, y], {x, -3, 3}, {y, -3, 3}, PlotPoints -> 25, 
  PlotRange -> {{-3, 3}, {-3, 3}, {-0.05, 0.4}}, 
  AxesLabel -> {"x", "y", ""}, ColorFunction -> Hue]]

enter image description here

Also, the legacy code for the Colors package is still available through the Wolfram library archive (MathSource).

$\endgroup$
1
  • $\begingroup$ "Colors.m" should be available, but the link to the file wasn't working when I tested it. $\endgroup$
    – dionys
    Oct 13, 2015 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.