## 5127 Reputation

16 years, 80 days

"A map that tried to pin down a sheep trail was just credible,

but it was an optimistic map that tried to fix a the path made by the wind,

or a path made across the grass by the shadow of flying birds."

- _A Walk through H_, Peter Greenaway

## sure...

@ABond Sure, you can make the F[i] be something else.

Below, F[i] is assigned the solution y(t) from sol[i].

```restart:

sys:= diff(y(t),t) = cos( 1/2*y(t)-x(t)-Pi^2 ):
ini:= y(0)=10*sqrt(2)/2:

F[0]:=sin:

N:=10:

for i from 1 to N do
newsys:=subs(x=F[i-1],sys);
#print(newsys);
sol[i]:=dsolve([newsys, y(0)=10*sqrt(2)/2], numeric,
output=listprocedure, known=F[i-1]):
eval(y(t),sol[i])(0.2);
#F[i]:=unapply('evalf'(subs(y(t)=eval(y(t),sol[i])(t),x=F[i-1],rhs(sys))),
#              t,numeric,proc_options=[remember]):
F[i]:=subsop(3=remember,eval(y(t),sol[i]));
end do:

plot([seq(F[k],k=1..N)],0.1..2.0,legend=[seq(F[k],k=1..N)],
color=[seq(RGB(0,1/((N-k+2)/7)^2,1-1/((N-k+2)/2)),k=1..N)],thickness=2);
```

Is that what you mean?

Option remember is being put on the F[i], since otherwise this whole approach gets very slow as N the number of iterations gets even moderately high (say, >6). There may be an altogether different way to do it (viz. your other posts about saving interpolants), but this seems at least simple.

## sure...

@ABond Sure, you can make the F[i] be something else.

Below, F[i] is assigned the solution y(t) from sol[i].

```restart:

sys:= diff(y(t),t) = cos( 1/2*y(t)-x(t)-Pi^2 ):
ini:= y(0)=10*sqrt(2)/2:

F[0]:=sin:

N:=10:

for i from 1 to N do
newsys:=subs(x=F[i-1],sys);
#print(newsys);
sol[i]:=dsolve([newsys, y(0)=10*sqrt(2)/2], numeric,
output=listprocedure, known=F[i-1]):
eval(y(t),sol[i])(0.2);
#F[i]:=unapply('evalf'(subs(y(t)=eval(y(t),sol[i])(t),x=F[i-1],rhs(sys))),
#              t,numeric,proc_options=[remember]):
F[i]:=subsop(3=remember,eval(y(t),sol[i]));
end do:

plot([seq(F[k],k=1..N)],0.1..2.0,legend=[seq(F[k],k=1..N)],
color=[seq(RGB(0,1/((N-k+2)/7)^2,1-1/((N-k+2)/2)),k=1..N)],thickness=2);
```

Is that what you mean?

Option remember is being put on the F[i], since otherwise this whole approach gets very slow as N the number of iterations gets even moderately high (say, >6). There may be an altogether different way to do it (viz. your other posts about saving interpolants), but this seems at least simple.

## hmm...

@serena88 I'm sorry, but if my earlier responses haven't addressed your new issues then I don't understand at all what you are now writing. I wish you the best of luck with it.

## hmm...

@serena88 I'm sorry, but if my earlier responses haven't addressed your new issues then I don't understand at all what you are now writing. I wish you the best of luck with it.

## and the problem is?...

@serena88 And so what exactly is the problem with that display?

## and the problem is?...

@serena88 And so what exactly is the problem with that display?

@serena88 Your written version of your problematic output is not clear enough. It is not clear whether you are getting elided terms (due to GUI settings), simply a Matrix which is too wide to be displayed without the GUI line-breaking individual rows, or the short form summary of a printed Matrix (which should be avoidable using the `rtablesize` setting in an earlier comment of mine).

It's hard to be sure, as you haven't uploaded a worksheet which shows the problem output. You can use the big green up-arrow in the editor of this site, to upload a Worksheet/Document.

@serena88 Your written version of your problematic output is not clear enough. It is not clear whether you are getting elided terms (due to GUI settings), simply a Matrix which is too wide to be displayed without the GUI line-breaking individual rows, or the short form summary of a printed Matrix (which should be avoidable using the `rtablesize` setting in an earlier comment of mine).

It's hard to be sure, as you haven't uploaded a worksheet which shows the problem output. You can use the big green up-arrow in the editor of this site, to upload a Worksheet/Document.

## don't repeat that portion...

@serena88 If you don't want a portion of your Worksheet/Document to be executed along with other portions then put it in a different execution/Document block and... simply don't keep re-executing it.

As you've written it, it reads as if your problem here is with worksheet execution flow and not with the individual operations.

It's hard to say for sure, as you haven't uploaded a worksheet that demonstrates the problem.

## don't repeat that portion...

@serena88 If you don't want a portion of your Worksheet/Document to be executed along with other portions then put it in a different execution/Document block and... simply don't keep re-executing it.

As you've written it, it reads as if your problem here is with worksheet execution flow and not with the individual operations.

It's hard to say for sure, as you haven't uploaded a worksheet that demonstrates the problem.

## DiagonalMatrix...

```restart:

#V:=Vector([11,12,13]):
#DD:=Matrix(V,shape=diagonal):
DD:=Matrix(3,[11,12,13],scan=diagonal):

result:=LinearAlgebra:-DiagonalMatrix([seq(DD,i=1..11)]):

interface(rtablesize=33):

result;
```

## DiagonalMatrix...

```restart:

#V:=Vector([11,12,13]):
#DD:=Matrix(V,shape=diagonal):
DD:=Matrix(3,[11,12,13],scan=diagonal):

result:=LinearAlgebra:-DiagonalMatrix([seq(DD,i=1..11)]):

interface(rtablesize=33):

result;
```

## ie0[3,3]...

@serena88 The (3,3) entry of Matrix ie0 is accessed as ie0[3,3]

## ie0[3,3]...

@serena88 The (3,3) entry of Matrix ie0 is accessed as ie0[3,3]

## filename extension...

@Lautrup Include the filename extension, which is .ms, at the end of that long string location "C:/...."

 First 9 10 11 12 13 14 15 Last Page 11 of 81
﻿