# Items tagged with functionfunction Tagged Items Feed

### four dimensional integration...

February 14 2015
1 1

Hi,

I am trying to discretize a kernel of the form $K(x,y,t,s)$. I want to evaluate a four dimensional integral of the form

\int\int\int\int K(x,y,t,s)*h_m(x)*h_n(y)*h_p(t)*h_q(s) dsdtdxdy, where limits of integration are from 0 to 1.

$h_m()$ are function of one variable.

please suggest how to evaluate this.

thanks

### How to define functions using expressions stored i...

February 09 2015
2 1

Let a be som expression like
a:=t^2

Now how do I define a function using a.

f:=t->a
doesnt work

### Plotting a function with an arbitrary exponent val...

February 09 2015
1 6

I've got the following piecewise function :

(x^2+y^2)^(alpha).arcsin(y/x) if (x,y) are in [-pi/2,pi/2]

0, (x,y)=(0,0)

1. How do I plot this function taking the alpha variable and the piecewise construct into account?

2. How can I check for points of discontinuity, indifferentiability from the plot/function itself?

### Problem with naief discrete logarithm algorithm...

January 28 2015
0 2

Dear mapleprimes users,

I have a problem concerning this function:

Naief := proc(A::integer,B::integer, p::posint)
local x, a:= A mod p, b:= B mod p;

for x from 1 to p-1 do
if a^x mod p = b then return x end if
end do;
print(¨No solution.¨)

end proc

It works fine for what it should do, finding x for a^x = b mod p by inserting x from 1 to p-1 until it finds an
apprioperate x.

My problem is concerning its computation time, which I like to calculate with:

Codetools:- Usage(Naief(a,b,p), output = [cputime], quiet, iterations= 2^12)

The problem is that keeps repeating

alot even when a,b and p are immensely huge. I dont know how to fix it, because I need real CPUtimes which increase
a,b and p increase. I get the idea that the values of the CPUtime are not realistic.

Thanks for the help!

### Simulate and plot a continuous function with varyi...

January 16 2015
0 5

Hi there,

I am trying to simulate the behaviour of an equation in the continuous domain for two different populations given a set of parameters.

S(t) = exp(-alpha·D(t)-beta·G·D^2(t))

where alpha and beta are known (and are different for two populations of cells), and G may be:

Case 1: G=1

Case 2: G = (D1^2+D2^2+2*D1*D2*exp(-lambda*T))/D^2 (where D1=D/3; D2=2·D/3; and lambda is also known)

For the Case 1, I need to simulate for different values of D. Even if for the purposes of this case, D(t) = D0 (a constant); I would like to know how I would do it for a time-dependent D, for example,  D(t) = D0·t, with a varying D0, for example in the range [1..8].

For the Case 2, I need to simulate under different values of T (for example in the range [1..8]), letting D be a constant, known value. In this case, D(t) is a piecewise function:

D(t) =
= D/3 if t=0

= 2·D/3 if t=T
= 0 for any other t

I really don't know how to write the expression for S(t) in this case.

I guess I need an array to store as many instances of S as numbers of parameters I have (8 values for D0 int he first case, and another eight for T).

And besides, it needs to be a function of t (even if in the first case, it is not; I'd like to simulate as if it were).

So I am at a loss when it comes to writing the expressions of S(t), and having it evaluated (and its values plot in the same graph using a palette for differente parameter values) for say, t=0..100.

Attached is my attempt: Mapleprimes_LQ_model_simulation.mw

Any ideas?

Thanks,

jon

### subs or eval product with function...

January 16 2015
1 11

Hello,

I have a question: why does the following not work and how can I make it work:

f(x)*a*b;
subs(a*b=y,%);

The result is f(x) a b but I want f(x) y. What can I do? I also tried eval.

Thanks and best regards.

### is it possible to generalize a function to a combi...

January 16 2015
0 0

is it possible to generalize a function to a combinatorial level for approximate axioms

for example, first 100 or 1000 data points satisfy axioms

or 100% satisfy a axioms which means satisfy to infinity

because i find data always not exactly satisfy the axioms,
i guess it only satisfy to some limit, this may explain why data has decimal number

or conversely is it possible to generalize some axioms which approximate the original exact axioms
then data can exactly satisfy the approximate axioms

can generalize a nested forloop to achieve this goal?

how can it be done in algebra point of view?

For example:

x*y = for loop -> for loop -> i*j

it can change for loop expression into algebra

for i from 1 to 10 do
for j from 1 to 10 do
print i*j
od:
od:

### Defining a function in a loop...

January 12 2015
1 1

I am having issues when defining functions in a loop. First, I define the first two functions as follows (here, r(x) is a function already assigned).

f_0 := x -> r(x):

f_1 := x -> r(x)*f_0(r(x)):

Then, I define successive functions in a for loop as follows.

for i from 2 to 10 do

f_i := x -> r(x)*f_[i - 1](r(x));

end do

The loop defines the function f_2 but compiles erroneously for f_3 which, and I do admit, relies on f_2. Does someone have an idea of how to fix this issue? Any help will be greatly appreciated. Thanks.

### Problem with function...

January 07 2015
0 3

Hi all!

I have this function:

I need to find only the x for which a^x = b mod p is a solution of.

### how to find a function example which is invariant ...

December 31 2014
0 0

f := x^2+y-z=0

f2:= y^2 +z-x = 0

after shift , solution shift too, can it be said it is invariant in parameter shift?

if not, any example to show a function which is invariant in parameter shift?

> solve(f);
/ 2 \
{ x = x, y = -x + z, z = z }
\ /
> f2 := y^2+z-x;
2
y + z - x
> solve(f2);
/ 2 \
{ x = y + z, y = y, z = z }
\ /
> f;
2
x + y - z = 0

### abs function dsolve...

December 30 2014
1 3

Hi all,

I am trying to solve the following differential equation numerically using dsolve,

y * abs (y''') = -1

y(0) =1, y'(0) = 0, y''(0)=0

it works fine when tthe absolute function is not there, i.e. yy''' = -1.

Do you have any suggestion?

### How to move curve labels?...

December 28 2014
1 4

When you label a function of curve, this label is put just next to it. Is there a way to move this label to another position of the same curve?

### the meaning of _type and conditional...

December 11 2014
1 2

Dear people in mapleprimes,

>define(INT, linear, conditional(INT(a::algebraic, X::name) = a*X, _type(a, freeof(X))), INT(X::name, X::name) = (1/2)*X^2);

>INT(2*x+4, x);

x^2 + 4*x

>INT(z+x, z);

(1/2)* z ^2+ x*z

is written in the help page of maple.

This code is to make a function INT.

What it means is that if INT(a::algebraic, x::name) then this is transformed into a*X, where a is independent from x.

And, INT(X::name,X::name) is transformed into (1/2)*X^2.

The first of what I want to ask you is the way of use of "_type", which is not in the help page, and as for names with "_" ahead,

it is written that "_" means internal command for Maple, so not to use it. Is it right to use a name with "_" ahead of it here?

The second of what I want to know is the way to use "conditional."

Please teach me the meaning of this.

I hope you will teach me the above questions.

Best wishes.

taro

### BodePlot function doesn't like inputs with units...

December 08 2014
0 5

I have been having problems with using the BodePlot function with units:

R1 := 18.2*10^3*Unit('Omega');

R2 := 10^3*Unit('Omega');

C1 := 470*10^(-12)*Unit('F');

C2 := 4.7*10^(-9)*Unit('F');

# wo is in hertz

wo := 1/sqrt(R1*R2*C1*C2);

# Q is unitless

Q := wo*R1*R2*C2/(R1+R2)

with(DynamicSystems);

sys := TransferFunction(wo^2/(s^2+wo*s/Q+wo^2));

This is the error message I got:

Error, (in Units:-Standard:-+) the units 1 and Hz have incompatible dimensions

I think the problem is that the BodePlot function doesn't expect 'wo' to have units.

So I tried to work around the issue by using the loglogplot but it doesn't seem to like

complex function even when I used abs to find the magnitude (with or without units).

Any workaround is appreciated.

### Why can I not define the square of a function/vari...

November 26 2014
1 4

Greetings,

Maple 15 allows the following syntax

omega := sqrt(w0^2*(1+((z-zf)/z0)^2))

But it does not allow this one

omega^2 := sqrt(w0^2*(1+((z-zf)/z0)^2))

Why is this so for functions and variables? Is there any way around this, I am really bugged by this issue. The Maple Math told me that the syntax was invalid so I had type the commands directly.

 3 4 5 6 7 8 9 Last Page 5 of 27
﻿