## 13598 Reputation

19 years, 197 days

## Works if 2022 and 2023 are both lowered ...

@nm I suspect that you already know this.

```restart;
integrand:=(2*x^n+1)/(x^(n+1)+x);
res2021:=convert(eval(integrand,n=2021),parfrac): # Takes a while
length(res2021); #19646
simplify(res2021-eval(integrand,n=2021)); # 0
```

In fact it also works for n=2023..2030.
for n = 2030 it takes between 10 and 15 minutes.

.

## Making 2022 symbolic...

@Thomas Richard I tried replacing the number 2022 by n:

```restart;
integrand:=(2*x^2022+1)/(x^2023+x);
integrand_n:=(2*x^n+1)/(x^(n+1)+x);
infolevel[int]:=3:
int(integrand_n,x);
eval(%,n=2022);
```

That revealed that a Risch-Norman integrator was successful.
Continuing with:

```int(integrand_n,x,method=_RETURNVERBOSE);
```

gave the information that norman, meijerg,and risch were successful.

## Works in Maple2024 too...

@Kitonum Your workaround works in 2024.0 too and is very fast.

## Inv_sierp...

@ I  have Mathematica 13.2, but I use it extremely little.
Thus I cannot step in right away.

## Build...

@Axel Vogt I noticed that you have an earlier build.
The results you get, however, are the same in RC4: `Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

## Very nice!...

@Rouben Rostamian  That is very nice.

## The sequence B in inv_sierp...

@ Why is the sequence B in inv_sierp being created?  It isn't used for anything.
B is a sequence of zeros and ones.

Another problem. K is a sequence of 0 and 2 only. So never odd.
Thus a part of the code can be commented out (as well as the B's):

```for j to k do
km := K[k - j + 1]; # either 0 or 2
t := t*2^d + cd - km;
(*if d = 2 then
if evalb(type(km, odd)) then t := 1 - t end if; # Never happens
end if;
if evalf(t) < 0 then t := t + 1 end if; *)  # Never
end do;```

You get the same result as before after commenting this out.
### Note:

I tried using the original inv_sierp code with nothing commented out.
The only change to the procedure was that I made it return t ,[K], [B]

```return t ,[K],[B]
end proc:
d := 2;
k := 20;
t := 0.6164;
P := sierp(d, k, t);

res:= inv_sierp(d, k, P);

```

res was:
res := 360798224641/2,
[2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2],
[1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1]

## Great!...

@ Yes, sierp now works beautifully.
I tried with N = 4, 5, 6, 7, and 8. It is very nice. For N=8 I changed the thickness to 1.

## Sierpinski triangle...

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.

## Putting in another return...

@ 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.

## 6 points...

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
```

## Firefox and duckduckgo...

@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.

## Use duckduckgo...

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

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

## Getting rid of the vertical part...

@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]);
```

 2 3 4 5 6 7 8 Last Page 4 of 228
﻿