**rules for using functions as basis vectors**I am trying to establish some rules to use a triad of functions as a
triad of basis vectors (i.e., Frenet-Seret formalism). I have achieved
most of the desired functionality but I can not get Mathematica to
properly expand dot products across parantheses. Here is my code.
(* define the tangent vector of the curve r[u] *)
r /: D[r[u_], u_] := t[u];
(* define the dot product relations between the triad vectors *)
{t /: t[u_].t[u_] := 1, t /: t[u_].n[u_] := 0, t /: t[u_].b[u_] := 0,
n /: n[u_].t[u_] := 0, n /: n[u_].n[u_] := 1, n /: n[u_].b[u_] := 0,
b /: b[u_].t[u_] := 0, b /: b[u...

**Calculating local maximum: how to use 'peaks' function, or which other function to use?**Hello,
I've been trying to run that program:
http://www.owlnet.rice.edu/~elec431/projects96/digitalbb/formantscode.html
Shortly, the goal is to locate local maximums of a graph named 'h' and plotted as semilogy(f,abs(h)).
It was defined:
w = hamming(length(x)); % x is the signal
f = w.*fs/(2*pi); % fs is the sampling rate of x
Next, 'h' is calculated.
Local maximums of 'h' are located with this part of code:
[floc,fmag] = peaks(abs(h));
allfmnts = f(floc);
However, it returns an error:
??? Subscript indices must either...

**rules for using functions as basis vectors #2**Thanks for the help but I'm hesitant to alter the attributes of Dot.
Also, it is not the orderless aspect of Dot that gives me my main
difficulty. I do not know how to specify the necessary rules. Here is an
updated version of my code.
(* here are the rules for dot products between the basis elements *)
{t /: t[u_].t[u_] := 1, t /: t[u_].n[u_] := 0, t /: t[u_].b[u_] := 0};
{n /: n[u_].t[u_] := 0, n /: n[u_].n[u_] := 1, n /: n[u_].b[u_] := 0};
{b /: b[u_].t[u_] := 0, b /: b[u_].n[u_] := 0, b /: b[u_].b[u_] := 1};
(* here are the relations between derivatives of the basis elemen...

**Use getdate function in a own Function**Hi,
I have written a stored proc with some temporary tables and also used
a getdate() in my stored proc. When i try to call the sproc the error
is that we can only use extended sprocs or function inside a sproc.
Now if try to write the stored proc directly inside a fuction ie copy
paste after changing my temp tables to tables the problem is , i get a
error invalid use of getdate in sproc.What do i do to get something
for my results inside a table.
Thanks in advance.
RVG
Care to post your code here? If you are using GetDate() as a default value
for an input parameter you may see an error simil...

**Function to use GA functions**I was wanting to use the GA toolbox to do the following:
1 Select a a combnation of various funtions; and
2 select the best settings for each funtion,
to provide the highest objective function value subject to a validation data set being used where the 'best results' are compared and validated against thje results acheived with the validation dataset.
Has someone done a similar exercise to this?
Adam
...

**how to use this function in s-function???**Hello!
I update my matlab version to release 14 but i don't understand how
to use this function in simulink.
My simulink model has a S-Function box with the name sgdm. It has in
input a mux with 11 inputs and it's output are only one.
i compiled sgdm with "mcc -m sgdm"
but it doesn't run. can you explain me the procedure to do this. the
help doesn't helps me at all and the examples aren't really clear :s
i also tried the s-function builder but i don't know how it
functions.
my function is this one. is it good prepared to transform in s
function?
thanks ...

**Using a function within a function**Hi,
Is it possible to declare a function within a function?
I intend to use QUAD to evaluate the integral where the function to
be evaluated is:
lambda*(exp(-lambda*x).
Do I have to write a separate function m-file for defining the
integrand?
Ant wrote:
>
>
> Hi,
> Is it possible to declare a function within a function?
>
> I intend to use QUAD to evaluate the integral where the function to
> be evaluated is:
>
> lambda*(exp(-lambda*x).
>
> Do I have to write a separate function m-file for defining the
> integrand?
help subfunctions
Thats what I got:
s...

**calling different functions but using one name; or assigning a function to a function?**Hi Folks,
I have a program written long ago that uses a function repeatedly. The
function contains an algorithm that returns a real value. Now I need to
update the program with another function that is an new version of the
algorithm. But I also need to maintain the ability to use the old
function/algorithm at times. They would never be used at the same time.
The user makes a selection of which algorithm to use. So what I am trying
to do is (in pseudo code)
function old_algo.....
function new_algo .....
And a lot of code that is
output:= algo(num1,num2,num3,num4,...

**How can I use the value of a variable from a 'edit-text' callback function to a listbox callback function and use it there?**I have this code taking the value in the edit_callback
function:
user_entry_epochs = str2double(get(hObject,'string'));
if isnan(handles.user_entry_epochs)
errordlg('You must enter a numeric value','Bad
Input','modal')
return
end
Do you know how can I use user_entry_epochs in the
listbox1_Callback or in button callback function?
Nick Nichols wrote:
>
>
> I have this code taking the value in the edit_callback
> function:
> user_entry_epochs = str2double(get(hObject,'string'));
> if isnan(handles.us...

**Cramer's rule using LinearAlgebra package?**Using the older linalg package, I could implement Cramer's rule, given
a matrix A and vector by (for example):
> A1:=copyinto(b,copy(A),1,1);
> det(A1)/det(A);
But I can't work out how to do something similar with the newer
LinearAlgebra package. For example:
> A1:=A;
> A1[1..4,1]:=b;
(for a 4x4 system). But this changes both A1 and A, so that
> Determinant(A1)/Determinant(A);
produces 1. If I assign A1:=copy(A) the same thing happens. Clearly I
want to write the vector b into a column of a copy of A, without
changing the original matrix A. S...

**Transform list of numbers into pure functions using replace rule**Hello,
I'm developed a program to invert satellite observations into
geophysical variables such as forest biomass. One of the input
parameters are the errors in the observation channels which can be
either constant or a function. To be consistent the program expects
all errors to be functions but they can also be constant functions
e.g. if the error is 4 then the input parameter is "4&".
I've however hit a problem with the replacement rule that allows me to
transform all input errors into a function. The following works as
expected in that constants in the li...

**How to open a logical partition and read all of its file using windows function ReadFile() ? Question How to open a logical partition and read all of its file using windows function ReadFile() ?**Hii
In my application , wanna copy all files from one partition to another
partition.
First I copied a file that I taken default and copied to another
partition.
The above operation is done by using the control code
"FSCTL_GET_RETRIEVAL_POINTERS".
The clusters used are read and wrote into destination volume using
readfile() and writefile() windows functions.
Now I gotta copy all files.....
So how to proceed ....??
Thanking you.
On Sat, 13 Jun 2009 09:37:42 -0700 (PDT), krish
<krishnampkkm@gmail.com> wrote:
>Hii
>
>In my applicatio...

**using javascript function in php function??**Can anyone see why the checkbox in the code below doesnt get ticked when the
textbox is changed
***This javascript function is called in the textbox's onchange event to
check it when it is changed*****
<script type="text/JavaScript">
function changed(x){
document.getElementById(x).checked=true;
}
</script>
******This php function determine whether the check box is shown or not
(actually does more than this but ive slimed down the code) and has the
javascript function in the onChange event of the echoed textbox
function editable($edfield,$unedfield,$xtratext,...

**error using function within a function** "find" previously appeared to be used as a function or command, conflicting with its
use here as the name of a variable.
A possible cause of this error is that you forgot to initialize the
variable, or you have initialized it implicitly using load or eval.
This is the message I get. I'm writing a new function, and use find within this new function. It seems I can't use it. Why? Thanks a lot.
On 10-09-15 03:43 PM, Raymond wrote:
> "find" previously appeared to be used as a function or command,
> conflicting with its
> use here as the name of ...

**Defining functions using the output of an other function**Hi
Is there any possibility in mathematica to define a function using te output
of another function such as D[] oder Solve[] ?
for ex.
r[t_]::=Solve[y=x^2,y,x];
That actually does not work, just in order to illustrate what i am talking
about^^
Thanks a lot
Eckhard
Hi Eckhardt,
the following is one of plenty possibilities to achieve what you probably
were looking for (I have replaced = by == within Solve, otherwise it
doesn't make much sense):
y[x_] = y /. First[Solve[y == x^2, y, x]]
note that I am using Set (=) instead of SetDelayed (:=) for the defi...

**Using undeclared function in template function** Consider the following program:
//-----------------------------------------------------------------------
template<typename T>
void foo(T v) { bar(v); }
void bar(int) {}
int main() { foo(5); }
//-----------------------------------------------------------------------
gcc compiles this just fine, but clang gives an error:
error: call to function 'bar' that is neither visible in the
template definition nor found by argument-dependent lookup
Which one is right?
Juha Nieminen <nospam@thanks.invalid> writes:
> gcc compiles this just fine, but clang gives ...

**use a function within a new function**Hello,
I have a function like:
phi(a,t) = sin(2*pi*(t-a)/T' + a/T)
where "T" is itself a function of "a" like here:
####
Plot3D[Sin[2*\[Pi]*((t - a)/3 + a/(a + 1))], {t, 0, 9}, {a, 0, 9},
AxesLabel -> {"t", "a", "ex"}, Lighting -> False,
ViewPoint -> {0, 0, 100}, PlotPoints -> 40, Mesh -> False];
####
Therefore, I would like to define T separately. Something like here:
####
T[a_] = a + 1;
phi[a_, t_] = Sin[2*\[Pi]*((t - a)/3 + a/T[a])];
Plot3D[phi[a, t], {t, 0, 720}, {a, 0, 720}, AxesLabel -> {"...

**using using variables in built in function**Hi I would like to define this function:
rsi=@(x)rsindex(close, x);
in order to use the optimization toolbox.
The problem is that rsindex (that is a built in function in Matlab) is the following:
function rsi = rsindex(closep, nperiods)
switch nargin
case 1
nperiods = 14;
case 2
if numel(nperiods) ~= 1 || mod(nperiods, 1) ~= 0
error('Ftseries:rsindex:NPERIODSMustBeScalar', ...
'NPERIODS must be a scalar integer.');
elseif nperiods > length(closep)
error('Ftseries:rsindex:NPE...

**Using function pointer in callback function**
Hi,
I am writing an app which encapsulates a multimedia timer. I implemented
a TimerProc as static member function and a static member variable pThis
as pseudo this variable to access in the static TimerProc function.
timeSetEvent uses TimerProc to set the callback function.
m_pCallback is a function that is passed using the
SetTimerCallbackFunction. It's a function that an object owning the
CMMTimer object can pass to the CMMTimer class. What I want is that
every time the TimerProc function is called, the m_pCallback function is
executed, resulting in the object owning the timer pr...

**What function do I have to use in IDL? MATLAB corresponded function**Hi,
There is a problem in searching the exact same function of MATLAB's
conv() in IDL.
Here is the MATLAB code:
--------------------------------------------------
t=[0:90];
Kall=[0.1,0.15];
curve1=Kall(1)*t.*exp(-(Kall(2))*t);
curve_ref=t.*exp(-0.5*t);
hcurve1=conv(curve_ref, curve1);
Ct=hcurve1(1:length(t));
plot(t, curve1, '*',t, Ct, '+')
--------------------------------------------------
I want to copy this code to IDL, however, I couldn't find the function
of convolution which work exactly same as MATLAB's conv().
Anybody can help me?
hcurv...

**Difference between using function overloading and function templates**Hi,
What is the major difference between function overloading and function
templates?
Thanks!
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
WittyGuy wrote:
> What is the major difference between function overloading and
> function templates?
Overloaded function set is predefined and limited (bounded). The set
of functions generated from a template can (and usually is) unbounded.
The rules for overload resolution are slightly different. For example,
to determine if a template can represent ...

**Pointer to Member Function used in member function**Hi,
Would you kindly advise me how to write pointer to member function,
used in a member function as shown below:
Class A {
public:
void f(){ void(*k)() = g;} // ok
void f1(){ void(*k)() = g1;}// error
private:
static void g(){}
void g1() {}
};
g() is a static function and pointer to the funcion can be used in
f(), but this is not satisfuctory for my purpose, becasue static g()
is not allowed to use non-static member data in the class. I whould
like to use pointer to non-static member function in f1(). I do not
know how to do so. Thank you for your time. My compiler is MC++6.
...

**Mathematica- Use a previous equation into the function Function**Dear All,
I am fairly new to mathematica. I am stuck with a problem I cannot solve. I would like to call a previous equation into the function Function. If a type directly the expression or copy paste it, it works. However, when I call the expression by its name it does not.
Here is the code for a more precise explanation:
In: ll
Out: d + a x + h x^2 + b y + e x y + c z + j z^2
In: Function[##, a x + b y + c z + d + e x y + h x^2 + j z^2] & @@ {Listp}
Out: Function[{a, b, c, d, e, h, j},
a x + b y + c z + d + e x y + h x^2 + j z^2]
It works well and I can use it to genera...

**Function declarations & use of static functions**Hello everybody,
I have a question concerning function declarations. When exactly do you have
to declare functions if you want to use them? I have two functions main()
and foo(), respectively defined in main.c and foo.c. There is no declaration
of foo() inside main.c, but main() calls foo().
If I compile both files (using gcc's -c option), and then link them, main()
calls foo() without any problem. How come ? Wasn't I suppose to declare
foo() within main.c so main() could call it?
Moreover, what exactly is the use of static functions ? Why would you want
to restrict a function to a c...