mehdi jafari

554 Reputation

13 Badges

6 years, 276 days

MaplePrimes Activity


These are answers submitted by mehdi jafari

The growth rate in every period is the difference of the blue points in the diagram.
 

restart

p1:=plot(x*sin(x),x=0..50):p2:=plot([seq]([Pi/2+2*i*Pi,Pi/2+2*i*Pi],i=0..7),style=point,color=blue):

plots:-display(p1,p2)

 

plots[animate](plot, [t*sin(t), t = 0 .. x], x = 0 .. 50)

 

NULL


 

Download MaplePrimes_Question.mw


 

restart

f:=(3*x^2+2*x-I)*(x+1)

(3*x^2+2*x-I)*(x+1)

(1)

solve(f)

-1, -1/3-(1/3)*(1+3*I)^(1/2), -1/3+(1/3)*(1+3*I)^(1/2)

(2)

RealDomain:-simplify(solve(f))

-1

(3)

``


 

Download solve.mw

I have some suggestions for you
for the first question, i think there is NOT as far as i know and only help documentation is availabe. and i think it is enough. since after having the initial knowlegde, rest of it is just using ordinary maple in Matlab interface.
for the second question, do NOT use symbolic computations with numeric ones in Matlab unless there is NOT another way. I have expericne on it and it is not a good way to do computations.
Good luck.

Edited.

There is an equivalent form of variation of a functional in form of differentiation. 
You can use this form to find variation of a functional with the corresponding boundary conditions.
but in this form, you should use physics package "diff" since you should differentiate with respect to another function.
see https://en.wikipedia.org/wiki/Euler–Lagrange_equation
 


 

restart:

P:=proc(f,n,a,b) local i,V;
V:=LinearAlgebra:-RandomVector[row](n,generator=a..b,outputoptions=[datatype=float[8]]):
seq(eval(f,x=(V[i])),i=1..n);
end proc

proc (f, n, a, b) local i, V; V := LinearAlgebra:-RandomVector[row](n, generator = a .. b, outputoptions = [datatype = float[8]]); seq(eval(f, x = V[i]), i = 1 .. n) end proc

(1)

P(x^2+sin(x),5,1,10)

HFloat(49.65698659871879), HFloat(49.65698659871879), HFloat(9.141120008059866), HFloat(35.72058450180107), HFloat(24.04107572533686)

(2)

 


 

Download proce.mw

for using plot3d you shouldn't assign x1, and it should remain varibale to get a range. when u assing x1, you can just use plot

 

restart

f2:=3.579167+3.537500*x1-2.645833*x2-0.250000*x1*x1-0.012500*x2*x1+0.175000*x2*x2;

3.579167+3.537500*x1-2.645833*x2-.250000*x1^2-0.12500e-1*x2*x1+.175000*x2^2

(1)

 plot3d (f2,x1=3..7 ,x2=3..7, axes=boxed);

 

x1:=5;
f1:=3.579167+3.537500*x1-2.645833*x2-0.250000*x1*x1-0.012500*x2*x1+0.175000*x2*x2;

5

 

15.016667-2.708333*x2+.175000*x2^2

(2)

 plot (f1, x2=3..7, labels=[grape, preference], axes=boxed);

 

 


 

Download plot.mw

i think the problem is due to maple can not determine the varibales sign in the "abs" function. so use assumptions to solve it :


 

restart

f:=sqrt(x)*ln(y);evalc(Im(f))

x^(1/2)*ln(y)

 

(1/2)*abs(x)^(1/2)*(1-signum(x))*ln(abs(y))+(1/2)*abs(x)^(1/2)*(1+signum(x))*(1/2-(1/2)*signum(y))*Pi

(1)

solve(evalc(Im(f)), {x,y}) assuming x>0

{x = 0, y = y}, {x = x, 0 <= y}

(2)

solve(evalc(Im(f)), {x,y}) assuming y>0

{x = x, y = 1}, {y = y, 0 <= x}, {x = 0, 0 < y}

(3)

g:=x*ln(y);evalc(Im(g))

x*ln(y)

 

x*(1/2-(1/2)*signum(y))*Pi

(4)

solve(evalc(Im(g)), {x,y})

{x = 0, y = y}, {x = x, 0 <= y}

(5)

 


 

Download assum.mw


 

restart

A:=[
y[a0]-y[d0],
k[d1]*y[a1]-k[d2]*y[d2],
k[d1]*y[a1]*x[1]-k[d2]*y[d2]*x[2]];

[y[a0]-y[d0], k[d1]*y[a1]-k[d2]*y[d2], k[d1]*x[1]*y[a1]-k[d2]*x[2]*y[d2]]

(1)

select(has,A,x);

[k[d1]*x[1]*y[a1]-k[d2]*x[2]*y[d2]]

(2)

remove(has,A,x);

[y[a0]-y[d0], k[d1]*y[a1]-k[d2]*y[d2]]

(3)

#or
select(has,A,[seq](x[i],i=1..2));

[k[d1]*x[1]*y[a1]-k[d2]*x[2]*y[d2]]

(4)

 


 

Download select.mw

it was better to upload the worksheet here, i think you should change " := " to " = " or bring the right hand side to the left with minus sign and without any " := " . i think it will work.


 

restart:printlevel:=2:

M:=5:

for i to M do
if i<=M then
N[i,0](u):=1;N[0,i](u):=0;
fi;od;  

1

 

0

 

1

 

0

 

1

 

0

 

1

 

0

 

1

 

0

(1)

 


 

Download another_way.mw

here is a numerical solution based on the procedure on this link :
https://www.mapleprimes.com/questions/123970-Finding-All-Roots-For-An-ODE-In-A-Given-Interval
 

restart:

allRoots := proc(f :: procedure, rng :: range, $)
local result, root;
  result := Vector(0, 'datatype = float');
  root := RootFinding:-NextZero(f, lhs(rng), 'maxdistance' = rhs(rng) - lhs(rng));
  while root <> FAIL and root <= rhs(rng) do
    result(numelems(result) + 1) := root;
    root := RootFinding:-NextZero(f, root, 'maxdistance' = rhs(rng) - root);
  end do;
  return result;
end proc:

f:=proc(x) sin(sqrt(x));end proc

proc (x) sin(sqrt(x)) end proc

(1)

allRoots(f,0..500)

Vector(7, {(1) = 9.86960440100000, (2) = 39.4784176000000, (3) = 88.8264396000000, (4) = 157.913670400000, (5) = 246.740110000000, (6) = 355.305758400000, (7) = 483.610615600000})

(2)

 

NULL


 

Download allroots.mw

@Preben Alsholm 
 

restart:

EQ:=diff(C(t,r),t$2)=(Z(r)^2-1)-(C(t,r)^2)/(4*alpha)*(1+((1+(16*(alpha)^2/C(t,r)^4)*(Z(r)^2-1)^2-(4*alpha*c/3)+(8*alpha*axi/C(t,r)^4)))^(1/2));

diff(diff(C(t, r), t), t) = Z(r)^2-1-(1/4)*C(t, r)^2*(1+(1+16*alpha^2*(Z(r)^2-1)^2/C(t, r)^4-(4/3)*alpha*c+8*alpha*axi/C(t, r)^4)^(1/2))/alpha

(1)

pdsolve(EQ)

C(t, r) = RootOf(-6*Intat(alpha/(-6*alpha*(-12*Z(r)^2*_g*alpha+3^(1/2)*(Int(((-4*alpha*c*_g^4+48*Z(r)^4*alpha^2+3*_g^4-96*Z(r)^2*alpha^2+48*alpha^2+24*alpha*axi)/_g^4)^(1/2)*_g^2, _g))+12*_g*alpha-6*_F1(r)*alpha+_g^3))^(1/2), _g = _Z)+t+_F2(r))

(2)

 

 


 

Download pdsolve.mw

dear saba, is this what you want ?


 

restart:

seq((rand(-0.5..0.5))(),i=1..100);

.3775318970, -0.816018978e-1, .4069399814, 0.436850085e-1, .3400491380, -.2479170987, -.3512207408, .3520884908, .3284431967, .4848657575, -.1791386899, -.1232575041, -.2524655778, 0.415600955e-1, -.2497371105, -.4648512003, .2807139719, -.2520269759, .1736016048, .3769801486, -.4414281014, -.3251280474, .4242775386, .3820156214, -.1894856664, 0.355971810e-1, -0.876596969e-1, .4631586324, .2262350965, -.4987583014, -0.577514277e-1, -.1300704008, -.2113775594, -.3423466445, -.3155519987, .3500474044, .4412388256, .4804309386, -.1620749471, .2995389112, .2310788109, .1395464705, .1070027478, -.2336220760, -.3235718624, -0.116933206e-1, .3600757475, .3613973235, -0.251119420e-1, -.1103399691, .2885438090, .2936223970, .4041439521, .2022338125, -.4142977244, 0.48001182e-2, -.1128453058, .3110457143, -.2925728264, -.1011149341, .3811756267, -.3500983792, .4594186023, -.4020483728, -.3367579919, -.4805910478, .2398511034, -.3562160995, .2713482470, -.4823600714, .4997302326, -0.543323339e-1, -.1878650770, .2789945410, -0.715776470e-1, .1761052304, .4313688588, -.2796250715, -.1844289845, .4848339962, .4762345853, .3604187411, -.2616383954, .3661844308, -.2666432152, .2765591826, -.2967571547, -0.776444908e-1, .3793445976, -.1646914707, .2421038691, -0.146469119e-1, -.4513732251, -0.575143578e-1, 0.376307310e-1, .4210504051, .2949097933, -.2470575237, -.4927796779, 0.465061082e-1

(1)

 

 


 

Download random.mw


 

restart:

eq1:=diff(A1(t),t$2)+2*diff(A2(t),t$2)+3*diff(A3(t),t$2)-4*diff(A1(t),t)+diff(A1(t),t)*diff(A2(t),t)+3*diff(A3(t),t);

diff(diff(A1(t), t), t)+2*(diff(diff(A2(t), t), t))+3*(diff(diff(A3(t), t), t))-4*(diff(A1(t), t))+(diff(A1(t), t))*(diff(A2(t), t))+3*(diff(A3(t), t))

(1)

eq2:=2*diff(A1(t),t$2)+3*diff(A2(t),t$2)-3*diff(A1(t),t)+2*diff(A2(t),t)+3*(A1(t));

2*(diff(diff(A1(t), t), t))+3*(diff(diff(A2(t), t), t))-3*(diff(A1(t), t))+2*(diff(A2(t), t))+3*A1(t)

(2)

eq3:=2*diff(A2(t),t$2)+3*diff(A3(t),t$2)-4*diff(A2(t),t)+2*diff(A3(t),t)+3*A1(t)+A2(t)+A3(t);

2*(diff(diff(A2(t), t), t))+3*(diff(diff(A3(t), t), t))-4*(diff(A2(t), t))+2*(diff(A3(t), t))+3*A1(t)+A2(t)+A3(t)

(3)

dsolve({seq}(eq||i,i=1..3));

[{A1(t) = ODESolStruc(_a, [{(diff(diff(diff(diff(_b(_a), _a), _a), _a), _a))*_b(_a)^4+(1/9)*(3604*_b(_a)-243*(diff(diff(_b(_a), _a), _a))*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^5*(diff(_b(_a), _a))+486*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))^2*_a+486*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))*_a+1404*(diff(diff(_b(_a), _a), _a))*_b(_a)^2*(diff(_b(_a), _a))*_a-477*_a+3180*(diff(diff(_b(_a), _a), _a))*_b(_a)^2+3180*(diff(_b(_a), _a))^2*_b(_a)+2332*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^3-27*_b(_a)^2*_a+240*_b(_a)*_a+3286*(diff(_b(_a), _a))*_b(_a)-1179*(diff(_b(_a), _a))^3*_b(_a)^3-4943*(diff(_b(_a), _a))^2*_b(_a)^2+477*(diff(_b(_a), _a))^2*_b(_a)^3-99*(diff(_b(_a), _a))*_b(_a)^3+2548*_b(_a)^2*(diff(_b(_a), _a))-3339*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))-5247*(diff(diff(_b(_a), _a), _a))*(diff(_b(_a), _a))^2*_b(_a)^2+9328*(diff(diff(_b(_a), _a), _a))*_b(_a)^2*(diff(_b(_a), _a))-54*(diff(_b(_a), _a))^2*_b(_a)^2*_a+273*(diff(_b(_a), _a))*_b(_a)*_a+972*(diff(diff(_b(_a), _a), _a))^3*_b(_a)^5-243*(diff(diff(diff(_b(_a), _a), _a), _a))^2*_b(_a)^6-648*_b(_a)^3*(diff(_b(_a), _a))^5+756*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^5+1188*_b(_a)^3*(diff(_b(_a), _a))^4+162*_b(_a)^2*(diff(_b(_a), _a))^5-2196*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^4+189*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^5-1008*_b(_a)^2*(diff(_b(_a), _a))^4-1908*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^3+45*(diff(diff(_b(_a), _a), _a))*_b(_a)^4+1434*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^4+2718*_b(_a)^2*(diff(_b(_a), _a))^3-477*_b(_a)*(diff(_b(_a), _a))^4-5080*(diff(diff(_b(_a), _a), _a))*_b(_a)^3+2332*_b(_a)*(diff(_b(_a), _a))^3-27*_b(_a)^3-453*_b(_a)^2-972*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^5*(diff(_b(_a), _a))-243*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^4*(diff(_b(_a), _a))^2-648*(diff(diff(_b(_a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))^3+972*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))^4+324*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^5*(diff(_b(_a), _a))^2+1215*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))^3+648*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^4*(diff(_b(_a), _a))-729*(diff(diff(_b(_a), _a), _a))^2*_b(_a)^4*_a+324*(diff(diff(_b(_a), _a), _a))*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^5+81*(diff(diff(_b(_a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))^2-162*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))^3-621*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^5*(diff(_b(_a), _a))-810*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))^2-243*_b(_a)^2*(diff(_b(_a), _a))^4*_a-306*(diff(diff(_b(_a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))+1575*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))^2+1998*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^4*(diff(_b(_a), _a))+7020*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*(diff(_b(_a), _a))-324*(diff(diff(_b(_a), _a), _a))*_b(_a)^3*_a+351*(diff(diff(diff(_b(_a), _a), _a), _a))*_b(_a)^3*_a+351*_b(_a)*(diff(_b(_a), _a))^3*_a+1440*(diff(diff(_b(_a), _a), _a))*_b(_a)^2*_a+1440*_b(_a)*(diff(_b(_a), _a))^2*_a)/(27*(diff(diff(_b(_a), _a), _a))*_b(_a)^2+27*(diff(_b(_a), _a))^2*_b(_a)-18*(diff(_b(_a), _a))*_b(_a)+9*_b(_a)-53) = 0}, {_a = A1(t), _b(_a) = diff(A1(t), t)}, {t = Int(1/_b(_a), _a)+_C2, A1(t) = _a}])}, {A2(t) = Int((18*(diff(A1(t), t))*(diff(diff(diff(A1(t), t), t), t))+36*(diff(diff(A1(t), t), t))^2-81*(diff(A1(t), t))*(diff(diff(A1(t), t), t))+54*(diff(diff(A1(t), t), t))*A1(t)+27*(diff(A1(t), t))^2-27*(diff(diff(diff(diff(A1(t), t), t), t), t))+150*(diff(diff(diff(A1(t), t), t), t))+80*(diff(diff(A1(t), t), t))+168*(diff(A1(t), t))+39*A1(t))/(27*(diff(diff(diff(A1(t), t), t), t))-18*(diff(diff(A1(t), t), t))+9*(diff(A1(t), t))-53), t)+_C1}, {A3(t) = (2043*A1(t)+318*A2(t)+3415*(diff(A1(t), t))+1871*(diff(diff(A1(t), t), t))-162*A2(t)*(diff(diff(diff(A1(t), t), t), t))+108*A2(t)*(diff(diff(A1(t), t), t))-54*A2(t)*(diff(A1(t), t))-27*(diff(A1(t), t))^2*A1(t)+135*(diff(diff(diff(A1(t), t), t), t))*(diff(A1(t), t))^2-99*(diff(diff(A1(t), t), t))^2*(diff(A1(t), t))+162*(diff(diff(A1(t), t), t))^2*A1(t)-234*(diff(diff(A1(t), t), t))*(diff(A1(t), t))^2-81*(diff(diff(diff(diff(A1(t), t), t), t), t))*(diff(diff(A1(t), t), t))+27*(diff(diff(A1(t), t), t))*(diff(diff(diff(A1(t), t), t), t))-81*(diff(A1(t), t))*(diff(diff(diff(diff(A1(t), t), t), t), t))-756*(diff(diff(diff(A1(t), t), t), t))*A1(t)+1395*(diff(diff(A1(t), t), t))*A1(t)+24*(diff(A1(t), t))*A1(t)+222*(diff(A1(t), t))*(diff(diff(diff(A1(t), t), t), t))-92*(diff(A1(t), t))*(diff(diff(A1(t), t), t))+1991*(diff(diff(diff(A1(t), t), t), t))-387*(diff(diff(diff(diff(A1(t), t), t), t), t))+108*(diff(A1(t), t))^3+108*(diff(diff(A1(t), t), t))^3+81*(diff(diff(diff(A1(t), t), t), t))^2+1002*(diff(diff(A1(t), t), t))^2+561*(diff(A1(t), t))^2+216*(diff(diff(A1(t), t), t))*(diff(A1(t), t))*A1(t)-81*(diff(diff(diff(A1(t), t), t), t))*(diff(A1(t), t))*A1(t))/(162*(diff(diff(diff(A1(t), t), t), t))-108*(diff(diff(A1(t), t), t))+54*(diff(A1(t), t))-318)}]

(4)

 


 

Download dsolve.mw

please upload your equations, i think you have syntax problem,
you should solve like this :
fsolve({eq1,eq2,eq3,eq4,eq5},{x1,x2,x3,x4,x5},x=0..1};

as an example :

restart:

eq1:=a1+3*a2+5*a3;eq2:=6*a1-12*a2+20;eq3:=8*a1-53*a2+23*a3;

a1+3*a2+5*a3

 

6*a1-12*a2+20

 

8*a1-53*a2+23*a3

(1)

fsolve({seq(eq||i,i=1..3)},{a1,a2,a3},a1=-5..0)

{a1 = -3.711111111, a2 = -.1888888889, a3 = .8555555556}

(2)

 

 

 

 


 

Download fsolve.mw

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