mehdi jafari

584 Reputation

13 Badges

7 years, 218 days

MaplePrimes Activity


These are questions asked by mehdi jafari

I have a question with a proc containing "if" statement. 
i want maple to do the calculations without just like Heaviside function does. how can it be done?is it possible?

restart

f1:=proc(x)
if x>=0 then 1
else 0
fi:end proc:

Matrix(2,[[f1(x)+2,2*f1(x)],[5,4]]);

Error, (in f1) cannot determine if this expression is true or false: 0 <= x

 

P:=f1(x)*exp(x)+5*x;

Error, (in f1) cannot determine if this expression is true or false: 0 <= x

 

diff(P,x)

0

(1)

 

 


but i can do all of the above with Heaviside(x). can i do the same with my procedure?

Download if.mw

i have a matrix named S. it has two variables with the names sigma1 and tau. i do some computations with these varibels to obtain a matrix named S_NEW. when i calculate S_NEW with parameters and then i substitute parameter tau with zero i got the answer a zero Matrix. but when i put tau=0 at the initiation of my code, i got another answer. what is the problem?

the second issue is related with the name of parametes in maple. when the varible has the name sigma1 (and tau=0), the matrix S_NEW is a matrix with the only component of (1,1). when i change the parameter name to sigma the matrix S_NEW is a matrix with the only component of (3,3). where is the problem?

 

restart:with(LinearAlgebra):

tau:=0;

0

(1)

S:=Matrix(3,[[sigma1,tau,0],[tau,0,0],[0,0,0]]):B1:=Matrix(3):

A12,B12:=(Eigenvectors(S)):

V12:= Matrix(Normalize~([Column(B12,1..3)],Euclidean)):

S_NEW:=simplify(V12^+.S.V12) assuming real ;

Matrix(3, 3, {(1, 1) = sigma1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0})

(2)

eval(S_NEW,tau=0)

Matrix(3, 3, {(1, 1) = sigma1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0})

(3)

 

 

 

Download problem.mw



i have a question about sets. how can i keep set members in order of addition not the defualt maple ordering.
in maple help, i saw the command setsort=0..8 but i do not know how to use it.
consider exmaple below:


 

restart

L:={}:

for j in [3,5,6,1] do
birth:=j:
L:=`union`(L ,{j});
od;

3

 

{3}

 

5

 

{3, 5}

 

6

 

{3, 5, 6}

 

1

 

{1, 3, 5, 6}

(1)

 


how can i keep L as order of addition? L={3,5,6,1}. thanks in advance

Download setoder.mw

how this integral can be calculated in the simplest form ? the second question is what exactly is done when using assuming? for example when using assuming real, all the functions or parameteres are affected? thanks in advanced

 

restart:with(IntegrationTools):

(int(int(exp(-(y-beta[0]-beta[1]*x-b0-b1*x)^2/(2*sigma^2))*exp(-b0)*exp(-b1),b0=0..infinity),b1=0..infinity,continuous=true) assuming real)

signum(limit(-(1/2)*Pi^(1/2)*exp((1/2)*(2*b1+2*beta[1])*x+(1/2)*sigma^2-y-b1+beta[0])*2^(1/2)*sigma*(erf((1/2)*(sigma^2+(b1+beta[1])*x-y+beta[0])*2^(1/2)/sigma)-signum(sigma)), b1 = infinity))*infinity

(1)

 


 

Download error_function.mw

i have a problem with a nonlinear equation containing Heaviside step function. fsolve does not return anything and SolveEquation command also returns incorrect answer. How can i solve this equation? any method or help is appreciated.


 

 

restart:

with(DirectSearch):

F:=x*(Heaviside(x-(S0))/(1-DD)+Heaviside(-x+S0)/(1-HH*DD));

x*(Heaviside(x-S0)/(1-DD)+Heaviside(-x+S0)/(-DD*HH+1))

(1)

EQ:=F-E*Y;

-E*Y+x*(Heaviside(x-S0)/(1-DD)+Heaviside(-x+S0)/(-DD*HH+1))

(2)

HH:=0.2;
DD:=0.579350262599427;
S0:=1e8;
E:=70e9;
Y:=0.001668993263529;

.2

 

.579350262599427

 

0.1e9

 

0.70e11

 

0.1668993263529e-2

(3)

EQ

-116829528.5+x*(2.377274752*Heaviside(x-0.1e9)+1.131055455*Heaviside(-x+0.1e9))

(4)

fsolve(EQ)

fsolve(-116829528.5+x*(2.377274752*Heaviside(x-0.1e9)+1.131055455*Heaviside(-x+0.1e9)), x)

(5)

SolveEquations(EQ)

Warning, complex or non-numeric value encountered; trying to find a feasible point

 

[1.3868049384289111*10^13, Vector(1, {(1) = -3723983.000}), [x = 9.999999999999999*10^7], 231]

(6)

eval(EQ,x = 1.00000000000000*10^8)

Float(undefined)

(7)

 


 

Download fsolve.mw

1 2 3 4 5 6 7 Last Page 3 of 20