help-octave
[Top][All Lists]
Advanced

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

Re: duplicate binary operator


From: David Bateman
Subject: Re: duplicate binary operator
Date: Wed, 04 Oct 2006 11:32:59 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Vergil Mueller wrote:
> David,
>
> Here's some code that gets me the error:
>
> C_1 = 1.8*10^(-4);
> C_2 = .11608;
> I_sc = A_ratio*26.9;
> V_oc = 257;
>
> symbols
> V_x=sym('V_max');
> f= ((V_x*I_sc*(C_1/(C_2*V_oc)))*e^(V_x/(C_2*V_oc))-1) - I_sc *
> (1-C_1*(e^(V_x/(C_2*V_oc))-1));
> V_max = symfsolve({f},{V_x == 1})
>
>
> Note that the solver spits out the right answer (V_max = 197.13)
> but there's a lot of gibberish output first (all the warnings nonsense).
>
> So one thing I didn't mention is the versions I'm using (I haven't
> even checked to see if this bug is fixed in a later version)
>
> octave 2.1.72-8
> octave-forge 2005.06.13-8
>
> I don't know if these are the most current versions, I'm only using
> the packages I can get my hands on through the MEPIS and Ubuntu
> repositories.

No its not fixed yet. The attached patch will fix the overloaded
function warnings you are seeing. However, there is another issue in
that symfsolve and findsymbols use deprecated list containers rather
than cell arrays. I'll let someone else fix that one if they are
interested. Its a two line fix in symfsolve, but as findsymbols is an
oct-file it is slightly more complex there. Also there appears to be
main other places lists are used. So rather than break the code, I've
left this alone..

D.

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

The information contained in this communication has been classified as: 

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

*** symbols.cc.~1.2.~   2006-08-24 17:30:34.000000000 +0200
--- symbols.cc  2006-10-04 11:16:55.949580639 +0200
***************
*** 31,36 ****
--- 31,37 ----
  #include <octave/oct-obj.h>
  #include <octave/pager.h>
  #include <octave/quit.h>
+ #include <octave/variables.h>
  
  #include <ginac/ginac.h>
  #include "ov-vpa.h"
***************
*** 119,135 ****
        return true;
  }
  
  DEFUN_DLD(symbols,args,,"Initialize symbolic manipulation")
  {
    octave_value retval;
!   octave_vpa::register_type ();
!   octave_ex::register_type (); 
!   octave_ex_matrix::register_type ();
!   octave_relational::register_type (); 
! 
!   install_ex_matrix_ops();
!   install_ex_ops();
!   install_vpa_ops();
    return retval;
  }
  
--- 120,158 ----
        return true;
  }
  
+ static bool symbolic_type_loaded = false;
+ 
+ void
+ load_symbolic_type (void)
+ {
+   if (! symbolic_type_loaded)
+     {
+       octave_vpa::register_type ();
+       octave_ex::register_type (); 
+       octave_ex_matrix::register_type ();
+       octave_relational::register_type (); 
+ 
+       install_ex_matrix_ops();
+       install_ex_ops();
+       install_vpa_ops();
+       symbolic_type_loaded = true;
+ 
+       // We should lock the constructor functions of this type in place,
+       // otherwise something like
+       // "symbols(); a=sym('V_max'); clear functions; a" generates
+       // a seg-fault. Note this relies on the fact that Fsym, Fex_matrix
+       // and Fvpa are linked into the symbols.oct file. If th
+       // moved to this locking needs to be rethought.
+       mlock ("sym");
+       mlock ("ex_matrix");
+       mlock ("vpa");
+     }
+ }
+ 
  DEFUN_DLD(symbols,args,,"Initialize symbolic manipulation")
  {
    octave_value retval;
!   load_symbolic_type ();
    return retval;
  }
  

reply via email to

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