Output assigning in Maple inside for loop

756 Views Asked by At

I am trying to define some solutions $x_k(t)$ inside a for loop in Maple.

I have tried

enter image description here

but I get an ugly output. I have also tried x[k]:=t-> ... but it makes an even uglier output.

If it wasn't inside a for loop I would have used

x[k] := t -> (...) : 'x[k](t)' = x[k](t) ;

to suppress the output from the assigning and make a nice output in the next line but it seems I cannot suppress only some of the lines inside a for loop?

2

There are 2 best solutions below

3
On

to suppress the output from the assigning and make a nice output in the next line but it you can use the tool step

> for k from 1 to nops (sols) steps 2 do
    x[k]=...

You will be able to suppress some of the lines inside of the loop.

2
On

Suppress all output from the loop using a colon statement terminator on the end do. And then use print inside the loop to prettyprint exact that which you want shown.

for k from 1 to nops(sols) do
  x[k] := unapply(c[k]*exp(lambda[k]*t).v[k],t);
  print('x[k](t)' = x[k](t));
end do: