Items tagged with for for Tagged Items Feed

Hi experts,

the standard resolution for maple contourplots is 72 dpi wich is not suitable for publication purposes. I need at least a resolution between 500 - 1000 dpi. How do I get better resolutions for my contourplots when exporting them to .bmp or .jpg-files?
Somebody any ideas?

Hello Hello everybody 
   I have to solve the following differential equation numerically 


``

 

restart:with(plots):

mb:=765 : mp:=587 : Ib:=76.3*10^3 : Ip:=7.3*10^3 : l:=0.92 : d:=10: F:=490: omega:=0.43 :

eq1:=(mp+mb)*diff(x(t),t$2)+mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(theta(t),t$2)+mp*l*cos(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*sin(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*sin(alpha(t)+theta(t)))-F*sin(omega*t)=0;

1352*(diff(diff(x(t), t), t))+587*(10*cos(theta(t))+.92*cos(alpha(t)+theta(t)))*(diff(diff(theta(t), t), t))+540.04*cos(alpha(t)+theta(t))*(diff(diff(alpha(t), t), t))+5870*(diff(theta(t), t))^2*sin(theta(t))+540.04*(diff(theta(t), t)+diff(alpha(t), t))^2*sin(alpha(t)+theta(t))-490*sin(.43*t) = 0

(1)

eq2:=(mp+mb)*diff(z(t),t$2)-mp*d*(sin(theta(t)+alpha(t))+sin(theta(t)))*diff(theta(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(alpha(t),t$2)+mp*(d*diff(theta(t),t)^2*cos(theta(t))+l*(diff(theta(t),t)+diff(alpha(t),t))^2*cos(alpha(t)+theta(t)))+9.81*(mp+mb)-F*sin(omega*t)=0;

1352*(diff(diff(z(t), t), t))-5870*(sin(alpha(t)+theta(t))+sin(theta(t)))*(diff(diff(theta(t), t), t))-540.04*sin(alpha(t)+theta(t))*(diff(diff(alpha(t), t), t))+5870*(diff(theta(t), t))^2*cos(theta(t))+540.04*(diff(theta(t), t)+diff(alpha(t), t))^2*cos(alpha(t)+theta(t))+13263.12-490*sin(.43*t) = 0

(2)

eq3:=mp*(d*cos(theta(t))+l*cos(alpha(t)+theta(t)))*diff(x(t),t$2)-mp*(l*sin(theta(t)+alpha(t))+d*sin(theta(t)))*diff(z(t),t$2)+(Ip+Ib+mp*(d^2+l^2)+2*mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+[Ip+mp*l^2+mp*d*l*cos(alpha(t))]*diff(alpha(t),t$2)-mp*sin(alpha(t))*(l*d*diff(alpha(t),t)^2-l*d*(diff(alpha(t),t)+diff(theta(t),t))^2)+mp*9.81*l*sin(alpha(t)+theta(t))+mp*9.81*d*sin(theta(t))=0;

587*(10*cos(theta(t))+.92*cos(alpha(t)+theta(t)))*(diff(diff(x(t), t), t))-587*(.92*sin(alpha(t)+theta(t))+10*sin(theta(t)))*(diff(diff(z(t), t), t))+(142796.8368+10800.80*cos(alpha(t)))*(diff(diff(theta(t), t), t))+[7796.8368+5400.40*cos(alpha(t))]*(diff(diff(alpha(t), t), t))-587*sin(alpha(t))*(9.20*(diff(alpha(t), t))^2-9.20*(diff(theta(t), t)+diff(alpha(t), t))^2)+5297.7924*sin(alpha(t)+theta(t))+57584.70*sin(theta(t)) = 0

(3)

eq4:=mp*l*cos(alpha(t)+theta(t))*diff(x(t),t$2)-mp*l*sin(alpha(t)+theta(t))*diff(z(t),t$2)+(Ip+mp*l^2+mp*d*l*cos(alpha(t)))*diff(theta(t),t$2)+(Ip+mp*l^2)*diff(alpha(t),t$2)-mp*9.81*l*sin(alpha(t)+theta(t))+l*d*mp*diff(theta(t),t$1)^2*sin(alpha(t))=0;

540.04*cos(alpha(t)+theta(t))*(diff(diff(x(t), t), t))-540.04*sin(alpha(t)+theta(t))*(diff(diff(z(t), t), t))+(7796.8368+5400.40*cos(alpha(t)))*(diff(diff(theta(t), t), t))+7796.8368*(diff(diff(alpha(t), t), t))-5297.7924*sin(alpha(t)+theta(t))+5400.40*(diff(theta(t), t))^2*sin(alpha(t)) = 0

(4)

CI:= x(0)=0,z(0)=0,theta(0)=0,alpha(0)=0,D(x)(0)=0,D(alpha)(0)=0,D(z)(0)=0,D(theta)(0)=0;

x(0) = 0, z(0) = 0, theta(0) = 0, alpha(0) = 0, (D(x))(0) = 0, (D(alpha))(0) = 0, (D(z))(0) = 0, (D(theta))(0) = 0

(5)

solution:=dsolve([eq1,eq2,eq3,eq4, CI],numeric);

Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8]

 

 

 

I don't know why it says : Error, (in f) unable to store '[0.]/(0.17571268341557e16+[-0.25659510610770e15])' when datatype=float[8]

 

Help pleaase!

thank you !!!

Download systéme_complet.mw

 

Hello, I'm new here, I hope there is someone willing to give me a hand with my problem. I've been trying to solve a problem with a for loop and I have errors in my code, could you please tell me what's wrong with the  bold part?

 

restart;

with(plots);

g := proc (F, A, B, X0, g::evaln) local f, a, b, E, x0, erreur, N, n, x1, ps, pp, pic; f := F; a := A; b := B; x0 := X0; E :=

evalf(abs(f(x0)));

erreur := 0.1e-3;

N := 100;

n := 0;

for i to N do x1 := evalf(x0-f(x0)/(D(f))(x0));

E := abs(f(x1));

n := n+1; ps[n] := plot([[x0, 0.], [x0, f(x0)], [x1, 0.]], color = green, thickness = 2);

x0 := x1 end do; g := evalf(x1); pp := plot(f(x), x = a .. b, color = red); pic := seq(ps[i], i = 1 .. n); display(pp, pic) end proc;
Warning, `i` is implicitly declared local to procedure `g`
f := proc (x) options operator, arrow; sin(x)-cos(2*x)+.2 end proc;
x -> sin(x) - cos(2 x) + 0.2
a := 0; b := 6;

 

 

 

Thank you very much!

 


Dear the specialst in programmation, please I need to put a conditon if in this procedure with this form: Can you correct me this code please. Thank you.


aaa:=proc(x,y,f,N)
local bb,
for i= from 1 to N do

bb[i]:=f(x[i],y);

if bb[i]<=2 then y:=3*x[i] else y::=x[i]^2end if ;

end do:

end proc

 

 

 

I have a procedure which give an approximate solution for ode.

This our procedure

RKadaptivestepsize := proc (f, a, b, epsilon, N).

It's working ( afther some 3 mistake found by a member in Mapleprime).

Then I would like to compute the error between exact and approximate.

RKadaptivestepsize: compute the approximate solution

analyticsol: analytic solution

 

## here, I compute the error
for N from 2 by 2 to 500 do
dataerror:= N->evalf(abs(RKadaptivestepsize(f,0,1,epsilon,N)[1+N][2]-(eval(analyticsol, x = 1))));
##  sequence of data error
data[error] := [seq([N, dataerror(N)], N = 2 .. 500, 2)]:
if  data[error][k][2]<=epsilon then   
printf("%a  is the number of steps required using 3-step Runge Kutta Method to achieve an  eroor of 1e-6 .", k)
break ;
end if;   
end do;
end do;

But its gives an error.: Error, reserved word `error` unexpected

Have any one an idea.

 

Hi,

I have a 4-D function that I have found an analytic expression for in Maple, but I want to generate a numerical 4-D array, which I can export for use in Matlab. However, I don't think I'm using a very good solution, because it is extremely slow (several minutes for even 10x10x10x10 elements). My code is

NumRange:=10:
NumElements:=10:
dx:=2*NumRange/(NumElements-1):
A:=Array(1..NumElements,1..NumElements,1..NumElements,1..NumElements,[seq([seq([seq([seq(evalf(rho(ws1,ws2,ws1p,ws2p)),ws2p=-NumRange..NumRange,dx)],ws1p=-NumRange..NumRange,dx)],ws2=-NumRange..NumRange,dx)] , ws1=-NumRange..NumRange,dx)],datatype=float);

Rho is an exponential with 10 terms in the exponents.

I also tried using four for-loops but that was even slower!

Thanks for any input

Hi all,
I've got this code but the second if statement does not seem to work within the for cycle... If I write it outside the cycle it works... Can you help me with this??? 
 
Dec := {1, 4}; Var := {2, 3, 5, 6}; n[1] := 4; n[2] := 3; n[3] := 2; n[4] := 3; n[5] := 4; n[6] := 2; Ut := {1, 2, 3}; pa[2] := {1}; pa[3] := {1, 2}; pau[1] := {3}; pa[5] := {4}; pau[2] := {5}; pa[6] := {4, 5}; pau[3] := {4, 6}; J := {3, 5, 6};
m := numelems(Ut); n := numelems(`union`(Dec, Var)); j := numelems(J);

if member(n, J) then A[n] := {`union`(pa[n], `intersect`(pau[3], {n}))}; jcur := j-1 end if

for i from n-1 to 1 do if member(i, J) then A[i] := `union`(`union`(A[i+1], pa[i]), `intersect`(pau[jcur], {i})); jcur := j-1 else A[i] := `union`(A[i+1], `intersect`(pa[i], {i})) end if end do

Thanks in advance
manuele

Hello,

restart:

N := N0-(1/2)*sqrt(2)*sqrt(Pi*Kc/d)*(sum(erfc((1/2)*(L*n+x)/sqrt(d*t))+erfc((1/2)*((n+1)*L-x)/sqrt(d*t)),

n = 0 .. infinity));

N0:=0.2:L:=0.25:Kc:=2*10^(-12):t:=360000:d:=2.010619298*10^(-10):

When I plot N vs x = 0..0.25 then there is no issue

plot(N,x=0..0.25,axes=box);

but when try to use a loop to get the data, Maple cannot evaluate

for x from 0 to 0.25 by 0.01 do

N[x]:=evalf(N0-sqrt(Pi*Kc/(2*d))*sum(((((erfc((n*L+x)/(2*sqrt(d*t))))+erfc(((n+1)*L-x)/(2*sqrt(d*t))))),n=0..infinity)));
end do;

Thanks

  

Uncertainties about for loop...

December 17 2013 serena88 85

Hello, I have a term that do not have the variable 'n' in it, but why is the calculated number different? For example, why is

QQ:=Matrix([[3],[4],[1]]);

for m from 1 to 2 do
for n from 1 to 2 do
QQ:=(QQ*m)+QQ;
end do:
end do:

Answer: QQ:=Matrix([[108],[144],[36]])

 

different from

 

QQ:=Matrix([[3],[4],[1]]);

for m from 1 to 2 do
QQ:=(QQ*m)+QQ;
end do:

Answer: QQ:=Matrix([[18],[24],[6]])

Finding a value ...

December 10 2013 Koerio 5

Hellp

 

for a task about the launch of a rocket we had to make a matrix OPL3 with in the first column the time T and in the second column the height of the rocket at that time.

I must Maple find the time where the rocket is at his highest point.

I can find how high the highest point is, but didn't succeed to find the corresponding time.
Can Maple tell me at wich time (= row # o/t matrix OPL3) the rocket is at his highest point.

I used the following to find the highest point.

ymin:=min(seq(abs(OPL3(i,2)),i=64..830));

Note: the diff equitation is numerically solved, so I can't use solve(....=0) (am I right here?)

Thanks!

Help with loops...

November 20 2013 jem4303 5

I am trying to work with a for do loop with a while component. I have the error but I am not sure what the desired error should be. I know it has to be small but how small?

 

Thanks

Find a loop do define these matrices, even for large values of n. Record the Matrix Mn 

 

all i,j=1,2,13,..,n for example 

N := `<|>`(`<,>`(1, 2), `<,>`(2, 2))

P := `<|>`(`<,>`(1, 2, 3), `<,>`(2, 2, 3), `<,>`(3, 3, 3))

Q := `<|>`(`<,>`(1, 2, 3, 4), `<,>`(2, 2, 3, 4), `<,>`(3, 3, 3, 4), `<,>`(4, 4, 4, 4))

 

Please help!!!

hi

how can I write two "for do" loops which one of them is inside the other

Say I wanted to print out all values from 1 to 8 but excluding 3, how would I do that using a for loop?

For example, this just stops after 2:

for i to 8 while i <> 3 do
print(i);
end do ;

whereas I want it to skip 3 so going 1,2,4,5,6,7,8.


For what I'm actually doing, I need i to run over a range but excluding one value.

 

Thanks!

 

1 2 3 4 Page 1 of 4