[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inline functions in Matlab R14
From: |
David Bateman |
Subject: |
Re: inline functions in Matlab R14 |
Date: |
Thu, 23 Sep 2004 14:24:38 +0200 |
User-agent: |
Mutt/1.4.1i |
Even worse, what do
inline('sin (x)')
and
inline('y (x)')
give.. I suspect they give
ans =
Inline function:
f(x) = sin (x)
and
ans =
Inline function:
f(x) = y (x)
since how can you tell if "sin" and "y" are functions or not. Even if they
aren't when you define the inline function they might be afterwards...
Another ambiguity is
inline('x+i'), inline('x+j'), inline('x+I'), inline('x+J')
the first two should have i and j ignored. But matlab doesn't define
I and J. Also what about the octave built in constants "e" and "E"?
Should they also be ignored...
I also noticed that matlab sorts the arguments in ascii order. So that
inline('a+Y') ->
f =
Inline function:
f(Y,a) = a+Y
Grrr, this is a case where matlabs documentation doesn't even closely
resemble what they actually do.
The attached patch tries to do something similar to the matlab behaviour.
I ignore the octave builtin constants "I", "J", "e" and "E"... John, its
up to you if you also want to drop these as potential inline function
arguments...
D.
2004-09-23 David Bateman <address@hidden>
* ov-fcn-inline.cc (Finline): Do what the other brand actually
does, rather than what they say they do.
According to Quentin Spencer <address@hidden> (on 09/22/04):
> Here's the output I get:
>
> < M A T L A B >
> Copyright 1984-2004 The MathWorks, Inc.
> Version 7.0.0.19901 (R14)
> May 06, 2004
>
>
> To get started, type one of these: helpwin, helpdesk, or demo.
> For product information, visit www.mathworks.com.
>
> >>
> >> inline ('p_1+1')
> ans =
> Inline function:
> ans(p_1) = p_1+1
> >> inline ('p+q')
> ans =
> Inline function:
> ans(p,q) = p+q
> >> inline ('abc+xyz')
> ans =
> Inline function:
> ans(abc,xyz) = abc+xyz
> >> inline ('Abc+xyZ')
> ans =
> Inline function:
> ans(Abc,xyZ) = Abc+xyZ
>
>
>
>
> David Bateman wrote:
>
> >According to John W. Eaton <address@hidden> (on 09/22/04):
> >
> >
> >>Can someone who has Matlab R14 say what it does in the following
> >>cases?
> >>
> >> inline ('p_1+1')
> >>
> >> inline ('p+q')
> >>
> >> inline ('abc+xyz')
> >>
> >>
> >
> >Could I also suggest the case
> >
> >
> > inline ('Abc+xyZ')
> >
> >as the documentation is seems to imply special treatment for upper and
> >lower case characters...
> >
> >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
patch.sort20040923
Description: Text document
Re: inline functions in Matlab R14, Philipp.Batchelor, 2004/09/22