mehdi jafari

769 Reputation

13 Badges

11 years, 341 days

MaplePrimes Activity


These are answers submitted by mehdi jafari

as maple help page :

fsolve( equations, variables, complex ); 

For a single polynomial equation of one variable with real coefficients, by default the fsolve command computes all real (non-complex) roots. It may not return all roots for exceptionally ill-conditioned polynomials.
but when u activate complex option,it does not return any complex part thus your solution does not have any complex part !

you can not solve your symbolic equation using fsolve, as u can see in the file uploaded !
hope it clearify the problem more !
good luck !


maple.mws

your boundary conditions should be of type numeric, when you use like "psi(h1)" maple assumes that psi is also function of h1 in addition to y, you should use definite numbers for h1 and h2 so that u can got the answer 

Download maple.mws

 

u should use exact arthmetic like this link : 

http://www.mapleprimes.com/questions/153233-How-To-Avoid-Round-Off-Errors-
good luck!

i also got zero in maple 17 !

in your working directory,made a text file with this name : testfile.txt
i put numbers from 1 to 15 in every line of this text file, now i read every line of this text file and put them in a Vector named A.

> restart:
> A:=Vector(15):
> FileTools[Text][Open]( "testfile.txt" );

for i to 15 do
> A[i]:=FileTools[Text][ReadFloat]( "testfile.txt" );
> od;

for i to 15 do
> A[i]
> od;

testfile.txt

Download maple.mws

 

restart:n:=9999971;s:=0;

9999971

0

(1)

for i from 2 while i<=(n/2) do
if modp(n,i)=0 then
s:=s+i;
end if
od;

if s=0 then
print( prime )
else
not prime
end if;

prime

(2)

 

it computes in 8seconds, but still maple isprime is so better !
but this code in C# responses in about 1 seconds.

Download prime.mw

write down system of differential equation in a regular mode so that we can help u in solving the system? i have created the function in maple , but my question is that u have the function phi, and your differential equations are in term phi, so what is the unkonw function that dsolve is going to solve ?! or where is the system of differential equation which are going to be solved?

function.mws

i think your problem is here that u forgot to write u(t) here : 

SOLN := dsolve( { a1,b1,c1, ICS }, {x1(t),y1(t),z1(t),u(t)} );
i added u(t) and it was solved in a short time :


Download maple.mws

 

what do u exactly want to do? do u know use of integration by parts? i think u can not use in your case , u should use integration by parts when u had an integration or your equations should be in form of integral, also u should use known functions to help u in more detailed way, for example :

with(IntegrationTools):
V := Int(exp(x)*cos(x), x);

Parts(V, cos(x));

or in definite integral 

V := Int(exp(x)*sin(x), x = a..b);
Parts(V, sin(x));
Parts(V, exp(x));

u can refer to ?IntegrationTools,Parts for more information on integration by parts .



 

restart:

V:=Vector(80);

V:=?

(1)

# u can see all of the elements are zero by this : #
for i to 80 do
V(i,1);
od;

# or u can make a matrix like this :#
M:=Matrix(80,1);

M:=?

(2)

M(1,1);

0

(3)

# u can also make your matrix function of sth by this :#

M1:=unapply(Matrix(80,1,a(t)),t):

M1(t)(1,1);

(a(t))(1, 1)

(4)

# u can now make your a(t)s zero only in time 0 ,not in all of the time by this : #

for i to 80 do
a(0)(i,1):=0
od:

# u can see that all of the elements of the matrix are zero in time 0 #
for i to 80 do
M1(0)(i,1);
od;

 

 



Download matrix.mws

u can also use this method :


restart;
de := diff(y(x), x$2)+4*y(x) = exp(-3*x);

`Diff(5,x)` := rhs(dsolve({de, y(0) = 2, (D(y))(0) = 0}, y(x)));

de := diff(y(x), `$`(x, 2))+4*y(x) = exp(-3*x)

`Diff(5,x)` := (3/26)*sin(2*x)+(25/13)*cos(2*x)+(1/13)*exp(-3*x)

(1)

 

Download try.mws

as Mr.Carl Love said. u should just type your codes or equations,so that we can help u on the issue.

here is an example :


S:=[seq](54054.054*sin(0.2*Pi*i),i=1..10);

S := [54054.054*sin(.2*Pi), 54054.054*sin(.4*Pi), 54054.054*sin(.6*Pi), 54054.054*sin(.8*Pi), 0., 54054.054*sin(1.2*Pi), 54054.054*sin(1.4*Pi), 54054.054*sin(1.6*Pi), 54054.054*sin(1.8*Pi), 0.]

(1)

evalf(%);

[31772.17577, 51408.46030, 51408.46029, 31772.17576, 0., -31772.17580, -51408.46031, -51408.46028, -31772.17575, 0.]

(2)

 


Download example.mws

i think it is not a good approach to compare the abilities and facilities of a software with the other one since every software has its own goal to achieve. but if we want to treat it as a competitional issue,maybe it will be useful,maybe not. i think maple soft company should investigate their users so that findout what are the range in age of major maple users so that they decide whether it is convinient to provide more facilities for them or not.
afterall it is a nice comment and maybe practical. 

 i2 means i2=diff(y(x), x$2)? or what ?

also u have many type problems,in equation 2 and 3 u have twice wrote i2 and i3 ?

if we consider i1=diff(y(x), x).i2=diff(y(x), x$2),i3=diff(y(x), x$3)

and also your second equation to be 2*i1+i2+2*i3 ... and the third to be 1/50*i3+4*i1-2*i2

we can do sth like this :

restart:

d1:=diff(y(t),t)-diff(y(t), t$2)-diff(y(t), t$3)=0;

d1 := diff(y(t), t)-(diff(y(t), `$`(t, 2)))-(diff(y(t), `$`(t, 3))) = 0

(1)

d2:=2*diff(y(t),t)+diff(y(t), t$2)+2*diff(y(t), t$3)-30-20*cos(5)-114*sin(5)=0;

d2 := 2*(diff(y(t), t))+diff(y(t), `$`(t, 2))+2*(diff(y(t), `$`(t, 3)))-30-20*cos(5)-114*sin(5) = 0

(2)

d3:=1/50*diff(y(t), t$3)+4*diff(y(t),t)-2*diff(y(t), t$2)=0;

d3 := (1/50)*(diff(y(t), `$`(t, 3)))+4*(diff(y(t), t))-2*(diff(y(t), `$`(t, 2))) = 0

(3)

sys:={seq}(d || i ,i=1..3);

sys := {diff(y(t), t)-(diff(y(t), `$`(t, 2)))-(diff(y(t), `$`(t, 3))) = 0, (1/50)*(diff(y(t), `$`(t, 3)))+4*(diff(y(t), t))-2*(diff(y(t), `$`(t, 2))) = 0, 2*(diff(y(t), t))+diff(y(t), `$`(t, 2))+2*(diff(y(t), `$`(t, 3)))-30-20*cos(5)-114*sin(5) = 0}

(4)

with(inttrans): with(plots):

Lap1:=laplace(sys,t,s);

Lap1 := {s*laplace(y(t), t, s)-y(0)-s^2*laplace(y(t), t, s)+(D(y))(0)+s*y(0)-s^3*laplace(y(t), t, s)+((D@@2)(y))(0)+s*(D(y))(0)+s^2*y(0) = 0, (1/50)*(s^3*laplace(y(t), t, s))-(1/50)*((D@@2)(y))(0)-(1/50)*(s*(D(y))(0))-(1/50)*(s^2*y(0))+4*s*laplace(y(t), t, s)-4*y(0)-2*s^2*laplace(y(t), t, s)+2*(D(y))(0)+2*s*y(0) = 0, 2*s*laplace(y(t), t, s)-2*y(0)+s^2*laplace(y(t), t, s)-(D(y))(0)-s*y(0)+2*s^3*laplace(y(t), t, s)-2*((D@@2)(y))(0)-2*s*(D(y))(0)-2*s^2*y(0)-30/s-20*cos(5)/s-114*sin(5)/s = 0}

(5)

Lp1:=subs(laplace(y(t),t,s)=Y(s),Lap1);

Lp1 := {s*Y(s)-y(0)-s^2*Y(s)+(D(y))(0)+s*y(0)-s^3*Y(s)+((D@@2)(y))(0)+s*(D(y))(0)+s^2*y(0) = 0, (1/50)*(s^3*Y(s))-(1/50)*((D@@2)(y))(0)-(1/50)*(s*(D(y))(0))-(1/50)*(s^2*y(0))+4*s*Y(s)-4*y(0)-2*s^2*Y(s)+2*(D(y))(0)+2*s*y(0) = 0, 2*s*Y(s)-2*y(0)+s^2*Y(s)-(D(y))(0)-s*y(0)+2*s^3*Y(s)-2*((D@@2)(y))(0)-2*s*(D(y))(0)-2*s^2*y(0)-30/s-20*cos(5)/s-114*sin(5)/s = 0}

(6)

ans:={seq}(solve(Lp1[i],Y(s)),i=1..3);

ans := {(s^2*y(0)+s*y(0)+s*(D(y))(0)-y(0)+(D(y))(0)+((D@@2)(y))(0))/(s*(s^2+s-1)), (s^2*y(0)-100*s*y(0)+s*(D(y))(0)+200*y(0)-100*(D(y))(0)+((D@@2)(y))(0))/(s*(s^2-100*s+200)), (2*s^3*y(0)+s^2*y(0)+2*s^2*(D(y))(0)+2*s*y(0)+s*(D(y))(0)+2*((D@@2)(y))(0)*s+20*cos(5)+114*sin(5)+30)/(s^2*(2*s^2+s+2))}

(7)

for i to 3 do
soln[i]:=invlaplace(ans[i],s,t);
od;

soln[1] := y(0)-(D(y))(0)-((D@@2)(y))(0)+(1/5)*((5*((D(y))(0)+((D@@2)(y))(0))*cosh(t*5^(1/2)/2)+sinh(t*5^(1/2)/2)*5^(1/2)*(3*(D(y))(0)+((D@@2)(y))(0)))*exp(-t/2))

soln[2] := y(0)-(1/2)*(D(y))(0)+(1/200)*((D@@2)(y))(0)+(1/4600)*((23*cosh(10*t*23^(1/2))*(100*(D(y))(0)-((D@@2)(y))(0))+5*23^(1/2)*(-96*(D(y))(0)+((D@@2)(y))(0))*sinh(10*t*23^(1/2)))*exp(50*t))

soln[3] := -15/2+y(0)+(1/2)*(D(y))(0)+((D@@2)(y))(0)-5*cos(5)-(57/2)*sin(5)+(1/30)*((15*cos(15^(1/2)*t/4)*(-(D(y))(0)-2*((D@@2)(y))(0)+10*cos(5)+57*sin(5)+15)+15^(1/2)*(-70*cos(5)-399*sin(5)+7*(D(y))(0)-2*((D@@2)(y))(0)-105)*sin(15^(1/2)*t/4))*exp(-t/4))+(10*cos(5)+57*sin(5)+15)*t

(8)

 



Download laplace.mws


u can plot these answer by assigning initial conditions like your last question.
u can easily subs your initial conditions in the answers and plot them.

u can do like this :

d1:=diff(y(x),x,x)+2*diff(y(x),x)+2*y(x)-5=0;
 ics := y(0)=0, D(y)(0)=0;

ans1:=dsolve({d1,ics},numeric);

with(plots):
odeplot(ans1,x=-1..1);

for two others,u can do sth simillar.

u can solve the odes in this way 

dsolve(d1);

which gives u the general answer,but u can not plot the answer since it has a general form, and for plotting u should choose initial conditions like i did and thus u will need dsolve(numeric). 

u can write your sequence like this :

seq(f, i = m..n, step):

so that 

a:=seq(i,i=1..150,0.5):


u can also refer to

?kronecker to see more about kronecker function in maple.

u can also create matrix in one of these forms :

M1 := `<|>`(0.1e-2, 0.5e-1, .151, .201, .301, .951, 2);

or as Markiyan says 

M2 := Matrix([0.1e-2, 0.5e-1, .151, .201, .301, .951, 2]);

and there are so many ways to define a matrix, u can also apply a funtion to your matrix with the command map .

but we do not know here what do u want exacly?



First 7 8 9 Page 9 of 9