OliverB

5 Reputation

One Badge

3 years, 242 days

MaplePrimes Activity


These are replies submitted by OliverB

@acer Also very nice. But I have to admit that you lost me on those colour adjustments... :-)

Is it correct that the "undefined" return value could also be used for the function ff instead of setting an artifically high or low value?

@acer Thanks again. You're a genious...

While looking through your procedure, I wonder why this hack of assigning extreme result values to the result function is required for the interpolation function. Is it because the interpolation function is not defined outside of the given data range (the circular shape) and therefore cannot be solved for the whole given data range x=-200..200, y=-200..200 in the implicitplot function?

I have adjusted the numeric result assignment in case of a non-numeric result of f(x,y) from -1000 to 10000 to remove the outer fuzzy line of all the implicitplots when the result values drop down from ~+9xx°C down to -1000°C.

Also modified the vhi and vlo values to show and calculate only those contours that actually have a meaning for the data. And added a few datapoints with numerical output for easier reading.

> ff := proc(x, y)
> local res;
> if not [x, y]::list(numeric) then return 'procname'(_passed); end if;
> res := f(x, y);
> if not res::numeric then 10000; else res; end if;
> end proc;


> TempStep := 100;
> vlo := ceil(min(ThermRes(2 .. (), TimeCol))/TempStep)*TempStep;
> vhi := trunc(max(ThermRes(2 .. (), TimeCol))/TempStep)*TempStep;
> ContPlotimpl := plots:-display(seq(plots:-implicitplot(ff(x, y) = v, x = -200 .. 200, y = -200 .. 200, color = ColorTools:-Color("HSV", [0.667*(1 - (v - vlo)/(vhi - vlo)), 1, 1]), legend = v), v = vlo .. vhi, TempStep));
> TextPlot := []; PointPlot := [];
> for i from 3 to 4 do
>      PointPlot := [op(PointPlot), plots:-pointplot([ThermRes(i, 2), ThermRes(i, 3)], color = ColorTools:-Color("HSV", [0.667*(1 - (ThermRes(i, TimeCol) - vlo)/(vhi - vlo)), 1, 1]), symbol = solidcircle, symbolsize = 15)];
>     TextPlot := [op(TextPlot), plots:-textplot([ThermRes(i, 2), ThermRes(i, 3), sprintf("%.1f", ThermRes(i, TimeCol))], color = ColorTools:-Color("HSV", [0.667*(1 - (ThermRes(i, TimeCol) - vlo)/(vhi - vlo)), 1, 1]), align = [right, above], font = ["Arial", 16])];
> end do;
> PointPlot := [op(PointPlot), plots:-pointplot([0, 0], color = ColorTools:-Color("HSV", [0.667*(1 - (ff(0, 0) - vlo)/(vhi - vlo)), 1, 1]), symbol = solidcircle, symbolsize = 15)];
> TextPlot := [op(TextPlot), plots:-textplot([0, 0, sprintf("%.1f", ff(0, 0))], color = ColorTools:-Color("HSV", [0.667*(1 - (ff(0, 0) - vlo)/(vhi - vlo)), 1, 1]), align = [right, above], font = ["Arial", 16])];
> plots:-display(Tubeout, Tubein, Coreout, ContPlotimpl, TextPlot, PointPlot);

Thank you again for your great help to solving this issue  !!!

@acer Hi, I have attached the zipped maple workbook. I have also tried out the implicitplot option but it seems like Maple does not find a solution for the interpolation function being set equal to the contour values:

> f := Interpolation:-Interpolate(points, values, method = lineartriangular)

> Plot100 := implicitplot(f = 100, x = -200 .. 200, y = -200 .. 200, scaling = constrained)

The same happens when trying to solve the function and plot it:

> solve({f(x, y) = 100}, {x, y})           --> {x = RootOf(unknown(_Z, y) - 100), y = y}

> plot(solve(f(x, y) = 100, {x, y}))

GraphTest.zip

BR, Oliver

@acer Thanks for these suggestions. I will try the alternatives and see if I can get something to work properly. Anyhow this will give me the possibility to sort out out-of-bounds contours and the corresponding legend entry.

Thanks again for the quick and very helpful support!!!

@acer 

Thank you again for your help. With your suggested adjustment of the contourplot command, it works fine. And sorry for not thinking about the Maple version.

Is it so that the 2d contourplot supports only the "coloring" option, so that it is only possible to have a gradient of the contours between two colours?

> ContPlot := contourplot((x, y) -> f(x, y), -200 .. 200, -200 .. 200, contours = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], legend = true, coloring = ["Blue", "Red"])

I was looking for a rainbow-colour kind of setting like shown earlier and a legend displaying the corresponding values. But I could not find any other working coloring options - and the contourplot3d does not have a legend. (As far as I could see, this has been improved in the 2023 version, so I may need to ask our IT to finally update the version...)

BR,
Oliver

Hi,

Thank you for the helpful hints. I will still need to try some things.
As you can see in the attached workbook, the surfdata function will plot the result fairly well (but for some reason, the zgradient colour option does not work), but I cannot create a contourplot from this.

> SurfPlot := plots:-surfdata(M, source = irregular, colorscheme = ["zgradient", ["blue", "green", "yellow", "orange", "red"], markers = [200., 400., 600., 800., 1000.]])

When using the interpolation package, the sharp edge at the top end of the temperature cone is heavily rounded in the interpolation function. This causes a quite fuzzy outline of contours if I plot a 3d contourplot.

> f := Interpolation:-Interpolate(points, values):
> Ppt := plots:-pointplot3d(M, color = red):
> Surf := plot3d(f, -200 .. 200, -200 .. 200):
> plots:-display(Ppt, Surf)

> plots:-contourplot3d(f, -200 .. 200, -200 .. 200, contours = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], orientation = [90, 0, 0], colorscheme = ["zgradient", ["blue", "green", "yellow", "orange", "red"], markers = [0., 0.25, 0.5, 0.75, 1.]])

For some reason, your suggested 2d contourplot from the 3d data does not work on my computer. I am currently still using Maple 2021 - may be this was adjusted in more recent versions?

> ContPlot := plots:-contourplot(f, min(points[() .. (), 1]) .. max(points[() .. (), 1]), min(points[() .. (), 2]) .. max(points[() .. (), 2]), contours = [seq(100 .. 1000, 100)])
Error, (in plot/iplot2d) invalid 1st argument (the function) _m1392920487392

GraphTest.maple

I would have preferred to include the maple code and figures as you did, but I really could not figure out how to do this. Copying from a document inserts tons of formatting rubbish :-(

BR,
Oliver

Page 1 of 1