0

I'm using octave symbolic and I try doing some equation solving but when i try to make a matrix of my equations for solve function i get this error

error: Python exception: OverflowError: Python int too large to convert to C long
    occurred at line 29 of the Python code block:
    d = sp.solve(eqs, *symbols, dict=True)
error: called from
    python_cmd at line 179 column 7
    solve at line 174 column 9
    tuneL at line 21 column 3

and here is the code that causes problem

syms b c d v;
syms E u L z real;


u=1.60217662 * 10^-18;
L=5/10^9;


z = 12799215218530416738

k=z*(E*u)^(1/2);
q=z*(E*u-u)^(1/2);

r1 = 1 + b - c - d == 0;
r2 = k - k*b - q*c + q*d == 0;
r3 = c*exp(i*q*L) + d*exp(-i*q*L) - v*exp(i*k*L) == 0;
r4 = q*c*exp(i*q*L)-q*d*exp(-i*q*L)-k*v*exp(i*k*L) == 0;

equ = [r1, r2, r3, r4];
zmi = [b, c, d, v];
s = solve(equ,zmi);

T = abs(s.v)^2;

is there a way around or do I just have to drop it? (I can't really make values other because they are physical constants)

skyMark
  • 1
  • 2
  • The error message mentions it's a *Python OverflowError*, not an Octave one. Therefore, isn't this a problem with the way Python handles the integers, rather than Octave? Also, please provide a [mcve], i.e. some code we can run. We specifically need the inputs you are using: `E, b, c, d, v` – Adriaan Apr 21 '20 at 08:35
  • A side note on your Octave programming: use a semicolon, `;` to terminate lines to prevent command line display (that slows execution of large programs to a crawl). Also it might be better to use `1i` rather than `i` for the imaginary unit if that works for Octave. For MATLAB it does, and prevents hard to debug errors where you have used `i` as a variable and later want to use it for imaginary calculations. – Adriaan Apr 21 '20 at 08:38

0 Answers0