help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: determinent of undefined matrix?


From: David Bateman
Subject: Re: determinent of undefined matrix?
Date: Sat, 11 Sep 2004 11:19:56 +0200
User-agent: Mutt/1.4.1i

According to Geraint Paul Bevan <address@hidden> (on 09/11/04):
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> NZG wrote:
> | I want to solve the determinent of a matrix containing an unknown s
> such as
> |
> | det[s 1;1 s]
> |
> | ans
> |     s^2 - 1
> |
> | in Matlab I just define
> | s = sym('s')
> | beforehand.
> |
> | This doesn't work in Octave, what's an equivalent method?
> | Does one exist?
> |
> 
> The sym function is part of octave-forge. I don't use it often (I
> usually use symbolic algebra tools for symbolic work) but using a recent
> version (2004.07.07, on Debian), it does seem to be broken.
> 
> octave> s = sym('s');
> octave> [s,0]
> error: octave_base_value::array_value(): wrong type argument `ex'

Explaining this message isn't that simple... What is happening here is
that concatentaion isn't defined on the symbolic type, so a widening
function was called on the symbolic type (why I that is even defined I
don't know!) to do the concatenation as a matrix, this widening operation
called array_value(), which of course doesn't doesn't exist for the
symbolic type...

The solution to this, now that concatenation can be used on user types,
is to define concatenation for the symbolic type.... 

You might have been able to use indexing to get around this, like

s = sym("s");
s(2,2) = s(1,1);

except that this isn't defined on symbolic scalars, you'll get the 
message

error: can't perform indexed assignment for ex type
error: assignment failed, or no method for `ex = ex'
error: evaluating assignment expression near line 3, column 8

So subassgn for scalars is not implemented.  The other way around this
till concatenation of symbolic types is done is to create the symbolic
matrix directly with the right values. Like

octave:1> s = ex_matrix(2,2,sym("s"),sym(0),sym("s"),sym(0))
warning: implicit conversion from scalar to string
warning: implicit conversion from scalar to string
panic: Segmentation fault -- stopping myself...
attempting to save variables to `octave-core'...
error: octave_base_value::save_binary(): wrong type argument `symbolic matrix'
save to `octave-core' complete
Segmentation fault

So that too is broken... Last chance, create an empty symbolic matrix and then
fill it.

octave:1> s = ex_matrix(2,2)
s =

[[0,0],[0,0]]
octave:2> s(1,1) = sym("s")
error: can't perform indexed assignment for symbolic matrix type
error: assignment failed, or no method for `symbolic matrix = ex'
error: evaluating assignment expression near line 3, column 8

So subsassgn on matrices isn't defined either!!! Given that I don't see
a way to do and this type needs 

* subsassgn for scalars and matrices to be implemented,
* swg-fault in ex_matrix fixed,
* concatenation implemented, and
* maybe load/save :-)

D.


-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]