problem with symbolic package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with symbolic package

Beginner1
Hi!
I have just installed symbolic package and this works for several matrixes
while it doesn´t work for others. Let me show you an example:

/*pkg load symbolic
syms kv Tv kq Tq kdroop_AC droop_FSM FSM_slope enable ki kp  w x3d_0 x3q_0
x1d_0 x1q_0 x2d_0 x2q_0  x4d_0 x4q_0 kdiff Vdref_perm kdiff Vqref_perm
Vdc_perm k0 Pmq_perm Pmd_perm wg0 ;
  %Outer loop:Vdc-Q
 
  A_ol=[0 0;0 0];
  B_ol=[-kv/Tv kv/Tv 0 0 0 0 -kv*FSM_slope*enable/Tv kv*enable/Tv
-kv*enable/Tv kv*enable/Tv;0 0 kq/Tq -kq/Tq -(kq/Tq)*kdroop_AC
(kq/Tq)*kdroop_AC 0 0 0 0];
  C_ol=[1 0;0 1];
  D_ol=[-kv kv 0 0 0 0 -kv*FSM_slope*enable kv*enable -kv*enable kv*enable;0
0 kq -kq -kq*kdroop_AC kq*kdroop_AC 0 0 0 0];*/
 
This piece of code works since when I type on the console B_ol or any other
previous matrix it outputs the matrix in symbolic:

>> B_ol
B_ol = (sym 2x10 matrix)

  [-kv   kv                                          -FSM_slope*enable*kv  
enab
  [----  --  0    0          0              0        ---------------------
----
  [ Tv   Tv                                                    Tv
  [
  [          kq  -kq   -kdroop_AC*kq   kdroop_AC*kq
  [ 0    0   --  ----  --------------  ------------            0
  [          Tq   Tq         Tq             Tq

  le*kv  -enable*kv   enable*kv]
  -----  -----------  ---------]
  Tv          Tv          Tv   ]
                               ]
                               ]
  0           0           0    ]
                               ]

>>

However, when I introduce these two new matrixes:

A_il=[0 1 0 0 0 0 0 0; 0 0 1 0 0 0 0 0;0 0 0 1 0 0 0 0; -(w^2-wg0^2) 0
-4*w^2 0 0 0 0 0;0 0 0 0 0 1 0 0;0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 1;0 0 0 0
-(w^2-wg0^2) 0 -4*w^2 0];
B_il=[0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 -1 0 1 0 -4*w*x3d_0;0 0
0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 -1 0 1 -4*w*x3q_0];

instead of obtaining their format in symbolic I obtain this message error:

error: octave_base_value::map_value(): wrong type argument 'scalar'

And I don´t understand why I cannot obtain A_il and B_il in symbolic format.

Can you help me?






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: problem with symbolic package

Przemek Klosowski-7
On 08/02/2018 10:46 AM, Beginner1 wrote:
However, when I introduce these two new matrixes:

A_il=[0 1 0 0 0 0 0 0; 0 0 1 0 0 0 0 0;0 0 0 1 0 0 0 0; -(w^2-wg0^2) 0
-4*w^2 0 0 0 0 0;0 0 0 0 0 1 0 0;0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 1;0 0 0 0
-(w^2-wg0^2) 0 -4*w^2 0];
B_il=[0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 -1 0 1 0 -4*w*x3d_0;0 0
0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 0 0 0 0;0 0 0 -1 0 1 -4*w*x3q_0];

instead of obtaining their format in symbolic I obtain this message error:

error: octave_base_value::map_value(): wrong type argument 'scalar'

Simplified case:

pkg load symbolic
syms kv;

a=[kv 1; 1 kv]

works, but

a=[0 1; 1 kv]

does not. I am not sure why but in general I personally prefer using maxima/rmaxima/wxmaxima for symbolic stuff.



Reply | Threaded
Open this post in threaded view
|

Re: problem with symbolic package

Colin Macdonald-2
On 2018-08-02 09:29 AM, Przemek Klosowski wrote:

> Simplified case:
>
> pkg load symbolic
> syms kv;
>
> a=[kv 1; 1 kv]
>
> works, but
>
> a=[0 1; 1 kv]
>
> does not.
This is because of at bug in Octave [1].

Workarounds include:

 > a=[[0 1]; 1 kv]
 > a=[sym(0) 1; 1 kv]

[1] https://savannah.gnu.org/bugs/index.php?42152

best,
Colin