Preben Alsholm

13703 Reputation

22 Badges

20 years, 115 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

I'm now convinced that somehow this algorithm has to be iterated.
Try this:
 

restart;
with(Fractals:-LSystem);
with(LSystemExamples);
PlotExample(SierpinskiTriangle,7);
for i from 1 to 10 do PlotExample(SierpinskiTriangle,i) end do;

Notice that PlotExample(SierpinskiTriangle,1);  looks like this:

I tried

plot(P,view=[0..1,0..1]);

and got:

Comparing this with Fig. 1 and Fig. 2  in the pdf file obtained from your link made me wonder if we are misunderstanding the algorithm.

@ I tried putting in a return at this place in the code:

K := K, km;
  end do;
  return K;

What I got was:
 

N := 500; 
P := [seq(sierp(2, 20, j/N), j = 0 .. N)]:

numelems(P); ## 10020
{P[]}; # 6 members {-1, 0, 1, 2, 3, 5}
{P[1..1260][]};# {-1, 0}
{P[1261..3760][]};# {1}
{P[3761..6260][]};# {2}
P[1]
{P[6261..8760][]};# {3}
{P[8761..8762][]};  # {0}
{P[8763..10020][]};  # {0, 5}

Here we see 6 different results.
In your code you have this:

for j to k do
    km := K[k - j + 1];
etc

Since k in this case k is 20 only the first 20 of the 10020 K-values will be used:
Whether that is a problem I have no idea.

You see only 6 points and yet expected 501. So of course something is wrong.
If you do:

 { P[] }

you will see the six lists:
{[1, 1], [1, 174763/524288], [174763/524288, 1], [174763/524288, 52429/262144], [174763/524288, 174763/524288], [174763/524288, 209715/524288]}
I tried this:

numelems(P);
{P[]}; # 6 members
{P[1..63][]};# one list
{P[64..188][]};# one list
{P[189..313][]};# one list
{P[314..438][]};# one list
{P[439..500][]};# one list
P[501]; #The last list

 

@Axel Vogt With Firefox and duckduckgo I get a bunch of resuls. If I scroll down I get to "More results".
(Actually, my system says "Flere Resultater"). If I click on that I get more results, etc. until there aren't anymore.

@nm I have used the search engine duckduckgo for years.

It's good and it doesn't have that problem.

@dharr If desired you can get rid of the vertical part by using style=point:
It may look slightly better if you add symbol=point. Here I used the default, which is symbol=diamond:

plots:-odeplot(Solution1,[[t,SA1(t),color="red",thickness=1,style=point,symbolsize=5],[t,SA2(t),color="blue",thickness=1]],t=0..50,labels=["Time t","Salicylic acid"],labeldirections=[horizontal,vertical]);

I have just set the ordering of answers  Date(oldest first):
I want to see if that makes any difference to the loading speed.
My previous setting was order  by votes.

@Carl Love Your last version is very good:
 

Include0View(plot([3 + sin(x),4-cos(x)], x= -Pi..Pi, thickness= 3));
Include0View(plot([3 + sin(x),4-cos(x),x=-Pi..Pi],thickness= 2,caption="A parametric plot"));

@Carl Love In Maple 2023.2 it appears that the default in this case is adaptive=geometric.

@Carl Love I get:

With adaptive=false I get a much better result (not so with adaptive=geometric or adaptive=true):
This is what I get with adaptive = false:

@Carl Love Just a note: Your procedure doesn't handle Rouben Rostamian's example:

Include0View(plot(10 + 1/(x-1)^2, x=0..2, thickness= 3));

 

@Rouben Rostamian  My intention was to see if it is possible to include an option includeaxis1.
Erik Vestergaard seem to be looking for that kind of thing.
Should MapleSoft decide that an option like that makes sense, they obviously don't need my help!

The above isn't meant as a workaround.  I gave such one earlier.
# Incidentally I just simplified my code above, so that plot errors come directly from plot.

@Rouben Rostamian  You are right. This option must be restricted to bounded functions.
It could just ignore the option in this case.
Here is what must be a feeble attempt:

plot2:=proc(f::{algebraic,procedure},r::{range,name=range(realcons)},{includeaxis1::truefalse:=false}) local VW,p; 
      if not includeaxis1 then return plot(_passed) end if;
      p:=plot(f,r,_rest);
      VW:=min(0,Optimization:-Minimize(f,r)[1])..max(0,Optimization:-Maximize(f,r)[1]);
      if not VW::range(realcons) or hastype(VW,'infinity') then
         printf(cat("A vertical range could not be determined.","\n")); 
         printf(cat("Using includeaxis1= false instead.","\n"));        
         return p
      else 
         plots:-display(p,'view' = VW)
      end if
end proc:
plot2(sin(x),x=0..Pi,color=blue);
plot2(sin(x)+2,x=0..Pi,includeaxis1,color=blue);
plot2(10 + 1/(x-1)^2, x=0..2,includeaxis1,color=blue);
plot2(-10 - 1/(x-1)^2, x=0..2,includeaxis1);
plot2(x->6+sin(x)*x,0..2*Pi,includeaxis1,color=blue);
plot2(x->-10 - 1/(x-1)^2, 0..2,includeaxis1);
plot2(sin(x),0..2*Pi,includeaxis1); # error check
plot2(sin,x=0..2*Pi,includeaxis1);  # error check

# Somewhat revised: includes the procedural version.

@Carl Love Thanks Carl. I wasn't aware of that. I tried plotting sin(x) on -Pi..Pi with thickness=0.05.
First I thought there wasn't anything to see, it's that thin.
With a white background and color = white you obviously can't see anything regardless of thickness.

4 5 6 7 8 9 10 Last Page 6 of 229