John Eric

Dr. John Eric

80 Reputation

6 Badges

12 years, 20 days

MaplePrimes Activity


These are questions asked by John Eric

Hello ,

I need your help , I have this loops and I  want to save data to a file , but the table save just the last one 

this is the code

thank you

for i from 1 by 1 to 3 do 
Q:=[]:
simplfloat:=rand(-1.0..1.0): 
a:=simplfloat():     
eq:=a+i:
Q:=[op(Q),[i,a,eq]]:
writedata("all.dat", Q):
end do;


exemple.mw

Hello ,

I need your helps to solve this integrale

Thank you
 

restart

``

int((x-a)^m/x, x)

int((x-a)^m/x, x)

(1)

``


 

Download Intégrale.mw

Hello everyone,

I need your helps .I have this code to solve equation numerically with random coefficients, but sometimes the solution find a singularity, for that I create conditional if to avoid it , but its does not work.

Thank you a lot.

 

NULL

restart

eq := a*(diff(x(t), `$`(t, 2)))+b*(diff(x(t), `$`(t, 1)))+sin(x(t))*(diff(x(t), `$`(t, 1)))+2/x(t);

  

cis := x(0) = .25, (D(x))(0) = 0;

 

Simpson := proc (f, a, b, n) local h, S1, S2, S, i; h := evalf(((1/2)*b-(1/2)*a)/n); S1 := 0.; for i from 0 to n-1 do S1 := S1+f(a+(2*i+1)*h) end do; S2 := 0.; for i to n-1 do S2 := S2+f(a+2*i*h) end do; S := (1/3)*h*(f(a)+f(b)+4*S1+2*S2); return S end proc:

 

amin:=0.1;amax:=0.2;

 

bmin:=15;bmax:=24;

 

Q1 := []; for jj to 10 do simplfloat := rand(-1.0 .. 1.0); h := simplfloat(); a := abs(amin+(amax-amin)*h); b := abs(bmin+(bmax-bmin)*h); solut := dsolve([eq, cis], numeric, maxfun = 0, output = procedurelist); sd := proc (i) options operator, arrow; abs(rhs(solut(i)[2])*rhs(solut(i)[2])) end proc; eng := Simpson(sd, 5, 6, 10); if 'FAIL' then return  else  end if; Q1 := [op(Q1), [jj, a, b, h, eng]]; writedata("test.dat", Q1) end do

Error, (in solut) cannot evaluate the solution further right of .22544264, probably a singularity

 


 

Download g.mw

hello,

i went to plot a complex numerical solution , i used odeplot but did not work

please help

Thank you very much 


 

restart; with(plots)

NULL

L := 1;

1

(1)

R := 0.57e-1;

0.57e-1

(2)

V := evalf(Pi*R^2*L);

0.1020703453e-1

(3)

pcy := m/V;

97.97164858*m

(4)

Am := 0.6e-1;

0.6e-1

(5)

``

k := evalf(2*Pi/(1.56*T*T));

4.027682890/T^2

(6)

h := 10; -1; zz := h+Am*cos(omega*t)

10+0.6e-1*cos(omega*t)

(7)

g := 9.81;

9.81

(8)

pe := 1025;

1025

(9)

T := 3.57;

3.57

(10)

omega := 2*Pi/T;

1.759995884

(11)

m := (1/2)*pe*evalf(Pi*R^2*L);

5.231105195

(12)

``

``

eq := m*(diff(z(t), `$`(t, 2)))-pe*g*L*R^2-pe*L*R^2*(diff(z(t), `$`(t, 2)))+I*R^3*pe*L*cosh(k*(zz+h))*cos(omega*t)*exp(-I*omega*t)/cosh(k*h)

1.900880195*(diff(diff(z(t), t), t))-32.66950725+(0.1607410765e-1*I)*cosh(6.320462130+0.1896138639e-1*cos(1.759995884*t))*cos(1.759995884*t)*exp(-(1.759995884*I)*t)

(13)

csi := z(0) = 0, (D(z))(0) = 0;

z(0) = 0, (D(z))(0) = 0

(14)

sol := dsolve({csi, eq}, numeric, maxfun = 0):

NULL

sol2 := simplify(evalf(expand(sol))):

fg1 := evalc(Re(sol)):

odeplot(rhs(sol), [t, z(t)], t = 0 .. 3, labels = ["t", "z(t)"], color = blue, thickness = 1, legend = ["z(t) "], axes = boxed)

Error, invalid input: rhs received sol, which is not valid for its 1st argument, expr

 

complexplot(sol, [t, z(t)], t = 0 .. 3, labels = ["t", "z(t)"], color = blue, thickness = 1, legend = ["z(t) "], axes = boxed)

Error, (in plots:-complexplot) invalid input: `plots/complexplot` expects its 2nd argument, r, to be of type {range, name = range}, but received [t, z(t)]

 

NULL

NULL

``


 

Download mapleprime.mwmapleprime.mw

1 2 3 4 5 6 Page 3 of 6