2 years, 57 days

## How do I substitute the base of an ifact...

Maple 2023

I wish to substitute only the base of the  expression like the following

 (1)

 (2)

 (3)

I wish my results to be

 (4)

such that

 (5)

 (6)

If there a way to do that? I understand that there is a command  which gives me more control, but the form of the result is rather inconvenient. I hope there is a more direct way to do the aforementioned operation.

## Invalid left hand side in assignment - i...

Maple 2022

I was trying to assign a Vector to a Vector inside a procedure. However, when the Vector has a size of 5, I was able to do that. But not when the Vector has a size of 7.

I have the following example. I can't assign the Vector over when the Vector has a size of 7 as shown in `oneStep_egcd2`.  But I can do that when the size is 5 in `oneStep_egcd`. Copying the contents over using a for loop works as expected.

 >
 > a:= 17; b:= 5;
 (1)

 > # prev := <1, a, 0, b, a>;
 (2)
 > curr := <0, a, 1, b, b>;
 (3)
 > oneStep_egcd := proc(prev::Vector, curr::Vector)     local q, t1, t2, t3;     if (curr[5] <> 0) then         q := iquo(prev[5], curr[5]);         t1, t2, t3 := prev[1] - curr[1] * q, prev[3] - curr[3] * q, prev[5] - curr[5] * q;         prev = curr;         curr[1], curr[3], curr[5] := t1, t2, t3;     end if: end proc:
 > oneStep_egcd(prev, curr)
 (4)

 > # prev := <1, 1, a, 0, 0, b, a>;
 (5)
 > curr := <0, 0, a, 1, 1, b, b>;
 (6)
 > oneStep_egcd2 := proc(prev::Vector, curr::Vector)     local q, sb_q, t1, t2, t4, t5, t7;     if (curr[7] <> 0) then         q := iquo(prev[7], curr[7]);         sb_q := (q);         t1 := prev[1] - curr[1] * q;         t2 := prev[2] - curr[2] * q;         t4 := prev[4] - curr[4] * q;         t5 := prev[5] - curr[5] * q;         t7 := prev[7] - curr[7] * q;         prev := curr;         curr[1], curr[2], curr[4], curr[5], curr[7] := t1, t2, t4, t5, t7;     end if: end proc:
 > oneStep_egcd2(prev, curr)

 > oneStep_egcd3 := proc(prev::Vector, curr::Vector)     local q, sb_q, t1, t2, t4, t5, t7, i;     if (curr[7] <> 0) then         q := iquo(prev[7], curr[7]);         sb_q := (q);         t1 := prev[1] - curr[1] * q;         t2 := prev[2] - curr[2] * q;         t4 := prev[4] - curr[4] * q;         t5 := prev[5] - curr[5] * q;         t7 := prev[7] - curr[7] * q;         for i to 7 do             prev[i] := curr[i];         end do;         curr[1], curr[2], curr[4], curr[5], curr[7] := t1, t2, t4, t5, t7;     end if: end proc:
 > oneStep_egcd3(prev, curr)
 (7)

## Cannot map a function with `mod`...

Maple 2022

I am slightly confused as I can't apply the seemingly correct function to a sequence. It seems like `modp` does not like my inverse. But I am not aware of any other way of finding the modular inverse.

 > a := i -> (1025 - 2^(10 - 2^i))^(-1) mod (1025 - 2^(10 - 2*2^i));
 (1)
 > a(1);
 (2)
 > a(2);
 (3)
 > map(i -> i + 1, {seq(1 .. 4)});
 (4)
 > map(i -> 1/(1025 - 2^(10 - 2^i)) mod (1025 - 2^(10 - 2*2^i)), {seq(1 .. 4)});
 > map(a, {seq(1 .. 4)});

## Unterminated loop when using operator as...

Maple 2022
```tot := 1:
for z in 1, x, y, q^2, 3 do
tot += z;
end do:
tot;
```

When I run the code above, Maple gives me "Error, unterminated loop".

However, if I change the code to

```tot := 1;
for z in 1, x, y, q^2, 3 do
tot := tot + z;
end do:
tot;```

Maple computes the result correctly.

I don't see how the loop is unterminated. Am I not allowed to use operator assignments in loops?

## How can I create a Vector using symbolic...

Maple 2021

I have the following example.

> A:= Vector(3,symbol=v)

A:=

>v[1]:= 5

v[1]:=5

> A

Is there any way such that v[1] is actually referring to the first element in the vector? In other words, changing v[1] actually modifies the vector A.

If the question does not make sense, then here is the actual scenario that I faced.

I need to solve a system of equations in the form of

2 = c[2] + a[1],
2 = 2*c[3] + a[2],
-2 = -3*c[1] + a[3],
-1 = -2*c[2] + a[1],
-1 = -c[3] + a[2],
1 = a[3]

where a[i], c[i] refers to the entries in the vector.

`solve` returns the following:

[[a[1] = 1, a[2] = 0, a[3] = 1, c[1] = 1, c[2] = 1, c[3] = 1]]

I then did an `assign(%)`. However, the entries in A and C are not changed. I want the answer returned by solve to be properly applied to the entries of the vectors.

 1 2 Page 1 of 2
﻿