[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issues with symbolic
From: |
José Abílio Matos |
Subject: |
Issues with symbolic |
Date: |
Sat, 13 Apr 2019 16:26:33 +0100 |
Hi,
I hope this is the right forum for this. While working with symbolic
I found two issues.
The first issue is that when defining a symbolic matrix:
# using sym
sym(zeros(20))
# using vpa
vpa(zeros(20))
Both options work but the former is much faster than the later, take as an
example a square matrix of size 20:
>> tic; vpa(zeros(20)); toc
Elapsed time is 66.9637 seconds.
>> tic; sym(zeros(20)); toc
Elapsed time is 6.87813 seconds.
It gets worse for large matrices. Probably due the quadratic nature of the
problem. :-)
I suspect that the problem is that there is a @sym/zeros method while vpa is
just a function.
The second issue came when I was switching between double precision and vpa
and it can be seen in the code below:
# Double precision (works)
N = zeros(3);
N (1:2:3, 1) = 1:2:3
# vpa (fails)
N = sym(zeros(3))
N(1:2:3,1) = sym(1:2:3)
The vpa case fails with
error: A(I,J,...) = X: dimensions mismatch
error: called from
mat_replace at line 128 column 7
subsasgn at line 101 column 13
The obvious fix is, of course, to use the transpose:
N(1:2:3,1) = (sym(1:2:3))'
My question are these issues worth to be reported to symbolics?
Best regards,
--
José Matos
- Issues with symbolic,
José Abílio Matos <=