[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Symbolic Bug 45423, is there a workaround
From: |
Mike Miller |
Subject: |
Re: Symbolic Bug 45423, is there a workaround |
Date: |
Mon, 8 May 2017 15:48:57 -0700 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Mon, May 08, 2017 at 15:39:45 -0700, Thomas D. Dean wrote:
> SymString = "syms s R1 C1 R2 C2 R3 R4 I_V1 V1 v_1 v_2 v_3 v_4"
> eval(SymString);
>
>
> ## this produces an error. An open bug report exists.
> Astring = "A=[ 0+1/R1 0-1/R1 0 0 1; 0-1/R1 0+1/R1+s*C1+1/R2 0-1/R2 0 0; 0
> 0-1/R2 0+1/R2+s*C2+1/R3 0-1/R3 0; 0 0 0-1/R3 0+1/R3+1/R4 0; 1 0 0 0 0;]";
> eval(Astring)
>
> ## this does not produce the error
> Astring = "A=[ 0+1/R1 0-1/R1 0 0 1; 0-1/R1 0+1/R1+s*C1+1/R2 0-1/R2 0 0;
> sym(0) 0-1/R2 0+1/R2+s*C2+1/R3 0-1/R3 0; sym(0) 0 0-1/R3 0+1/R3+1/R4 0;
> sym(1) 0 0 0 0;]";
> eval(Astring)
>
> This is in the middle of a complex matlab script, scam.m.
>
> Is there an easy workaround?
What you have is an easy workaround.
A slightly easier workaround is to put square brackets around the rows
that don't contain syms. This is mentioned at
https://github.com/cbm755/octsympy/issues/8.
For your example that looks like
Astring = "A=[ 0+1/R1 0-1/R1 0 0 1; 0-1/R1 0+1/R1+s*C1+1/R2 0-1/R2 0 0; 0
0-1/R2 0+1/R2+s*C2+1/R3 0-1/R3 0; 0 0 0-1/R3 0+1/R3+1/R4 0; [1 0 0 0 0];]";
--
mike