MaplePrimes Questions

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

Dear Maple enthusiasts,

I was debugging a piece of Maple code I wrote with 3 for loops in it, because Maple kept running infinitely when I executed the worksheet. I found out that in the inner most loop Maple was getting stuck on integrating a function with a discontinuity. However, at the same time I noticed another flaw, namely that it was integrating the negative part of that same function as well as the positive. I had forgotten to implement that Maple should only integrate the positive part of the function. 

So I thought the easiest way for Maple to integrate the function would be to use piecewise() to get rid of the negative part and then integrate the piecewise function. To test this, I temporarily changed the integration interval so that no discontinuity would be present. However, Maple runs for an infinite amount of time when it tries to integrate the piecewise function. Also, I still don't have a clue how to deal with the discontinuities that occur in the real integration interval (when using piecewise). 

Attached at the bottom of this message is the code taken from the inner most for loop. In italic it shows the "problem section" with the piecewise function. The plots were there to help me visualise the functions and what's happening. They'll be removed in the final code.

Can someone help me to try and get the integration of the piecewise function to work? The integration interval in the code is the real integration interval. The discontinuities occur there where peicewise makes the function zero.

Many thanks!

 

restart: with(plots): with(linalg): with(Optimization): with(ListTools):

Average percentage of sunhours per day in a certain month
Sun_jan:=0.735: Sun_feb:=0.715: Sun_mar:=0.67:
Sun_apr:=0.615: Sun_may:=0.64: Sun_jun:=0.56:
Sun_jul:=0.43: Sun_aug:=0.37: Sun_sep:=0.43:
Sun_oct:=0.715: Sun_nov:=0.81: Sun_dec:=0.74:

Constants
I_sc:=1367.7:
H:= 150:
t_D:=0:
lat:=evalf((9+24/60+27/3600)*Pi/180):
lon:=evalf((51/60+12/3600)*Pi/180):
LC:=evalf((lon*180/Pi-0)/15):
alfa_alt:=evalf(-0.83*Pi/180):

H_zeni:=1.2:
H_azi:=3.6:
N:=116:

E_year:=0:

Initialise all necessary collector and radiation variables

I_o:=evalf(I_sc*(1+0.0333*cos((2*Pi*N)/365))):
delta:=evalf(arcsin(0.39795*cos(0.98563*(N-173)*Pi/180))):
x_input:=(2*Pi*(N-1))/365.242:
EOT:=x->evalf(0.258*cos(x)-7.416*sin(x)-3.648*cos(2*x)-9.228*sin(2*x)):
ts_input:=t->t+EOT(x_input)/60-LC-t_D:
omega:=ts->15*(ts-12)*Pi/180:
omega_set:=evalf((arccos((sin(alfa_alt)-sin(lat)*sin(delta))/(cos(lat)*cos(delta))))):
ts_rise:=evalf(-(omega_set*180/Pi)/15+12):
ts_set:=evalf((omega_set*180/Pi)/15+12):
t_rise:=ts_rise-EOT(x_input)/60+LC+t_D:
t_set:=ts_set-EOT(x_input)/60+LC+t_D:
t_noon:=12-EOT(x_input)/60+LC+t_D:
alfa_elev:=omega->evalf(arcsin(sin(delta)*sin(lat)+cos(delta)*cos(lat)*cos(omega))):
theta:=alfa_elev->Pi/2-alfa_elev:
alfa_azitest:=evalf(arccos((sin(delta)*cos(lat)-cos(delta)*cos(omega(ts_input(t)))*sin(lat))/cos(alfa_elev(omega(ts_input(t)))))):

Calculate direct and normal intensity I with mathematical model on time t of day N

a_0:=0.4237-0.00821*(6-H*0.001)^2:
a_1:=0.5055+0.00595*(6.5-H*0.001)^2:
k_HCDmod:=0.2711+0.01858*(2.5-H*0.001)^2:
I_HCDmod:=theta->I_o*(0.95*a_0+0.98*a_1*exp(-(1.02*k_HCDmod)/cos(theta))):

theta_noon:=evalf(theta(alfa_elev(0))):
I_noon:=evalf(I_HCDmod(theta_noon))*3600: Zet I om van W/m² naar J/(m².uur) voor toekomstige integratie
I_HSmod:=evalf(I_noon*sin(((t-t_rise)*Pi)/(t_set-t_rise)));

Calculate the real radiation energy on the collector for a whole clear day N per (m²)

RF_morning:=evalf(sin(alfa_elev(omega(ts_input(t))))*cos(H_zeni)+cos(alfa_elev(omega(ts_input(t))))*sin(H_zeni)*cos(H_azi-alfa_azitest));
plot(RF_morning,t=t_rise-1..t_noon);

RF_afternoon:=evalf((sin(alfa_elev(omega(ts_input(t))))*cos(H_zeni)+cos(alfa_elev(omega(ts_input(t))))*sin(H_zeni)*cos(H_azi-(2*Pi-alfa_azitest))));
plot(RF_afternoon(t),t=t_noon..t_set+1);

I_real:=piecewise(RF_morning>=0 and I_HSmod>=0 and t<=t_noon,RF_morning*I_HSmod,RF_afternoon>=0 and I_HSmod>=0 and t>t_noon,RF_afternoon*I_HSmod);
plot(I_real,t=t_rise-1..t_set+1);

E_clear:=int(I_real,t=t_rise..t_set,numeric=true);

Apply the average sunhours per day to the radiation energy to go get the real I for an average day (same percentage per hour)

if N<=31 then E_av:=E_clear*Sun_jan elif (N>31 and N <=59) then E_av:=E_clear*Sun_feb
elif (N>59 and N <=90) then E_av:=E_clear*Sun_mar elif (N>90 and N <=120) then E_av:=E_clear*Sun_apr
elif (N>120 and N <=151) then E_av:=E_clear*Sun_may elif (N>151 and N <=181) then E_av:=E_clear*Sun_jun
elif (N>181 and N <=212) then E_av:=E_clear*Sun_jul elif (N>212 and N <=243) then E_av:=E_clear*Sun_aug
elif (N>243 and N <=273) then E_av:=E_clear*Sun_sep elif (N>273 and N <=304) then E_av:=E_clear*Sun_oct
elif (N>304 and N <=334) then E_av:=E_clear*Sun_nov elif (N>334 and N <=365) then E_av:=E_clear*Sun_dec end if:

E_av;

ProjOfEigenVector := MatrixMatrixMultiply(BeProjected, (Transpose(OrthoBasis).MatrixInverse(MatrixMatrixMultiply(OrthoBasis, Transpose(OrthoBasis)), method = pseudo).OrthoBasis));

i use definition of this 

# P=(A*B’).inv(B*B’).B

#P=A*(B’).inv(B*B’).B)

however, no matter whatever matrix A pass into this equation in order to project onto B,

it still return the original matrix A

how can this definition be used to project a matrix onto another matrix?

how to correctly to project a matrix onto another matrix

I have an Array that has both floats and pi and e expressions mixed in.  Would like to scan the Array and print the non-floats to the screen.

My if then statement works until I put it into a loop then I get no output.  Puzzled...

> hits := identify(d);
> for i from 1 to 501 do if type(Hits[i], 'float') = false then Hits[i] end if end do;

Hi there,
i am currently using maple5 as a new student in mathematics in the university. I am trying to know how to use maple5 to programme finding roots of quadratic equation. can anyone point me in the right direction?? Perhaps a book or a website on maple5. I know its old version but that's what we are allowed to use in my university and i'm new to this. Thanks

I'm trying to create a small app for Maple Player to graph solids of revolution. When I run the app in the desktop version of Maple T.A it works, but when I move it into the Maple Player App it crashes. Any ideas?

Let OA=OB=OC=R=3,AB=3√2 and BC=2√2 .Find AC?

I am interested in implementing this worksheet: http://www.yorku.ca/marko/ComPhys/NoncomProduct/NoncomProduct.html

and variations on it, in maple.  However, it seems very clumsy.  acer of stackoverflow (http://stackoverflow.com/questions/21051935/taylor-expansion-of-an-operator-product) recomended I ask my question here.

would this worksheet be super easy to implement in maple 17 (don`t know what the difference between maple 17 and mapleprimes is..)? 

hi, I am new here I want to solve these toe coupled equations with the following boundary condition numerically:

  1)  diff(f(eta),eta$3)+(1)/(2)*f(eta)*diff(f(eta),eta$2)-Pi*(2*f(eta)*(diff(f(eta),eta))*

(diff(f(eta),eta,eta))+f(eta)^2*(diff(f(eta),eta,eta,eta))+eta*(diff(f(eta),eta))^2*(diff(f(eta),eta$2)))-K*

(diff(f(eta),eta)-1)=0

2)   diff(theta(eta),eta,eta)+(1)/(2)*Pr*f(eta)*(diff(theta(eta),eta))=0

boundary conditions: 1)  f(0) = 0   2)  D(f)(0) = 0   3)  D(f)(infinity=10) = 1

                               1) theta(infinity=10) = 1      2) theta(0)=0

Pi=0.1    K=0.2

Hi. I need to calculate the elements of the large two-dimensional symmetric matrix.

for j from 1 to N do
for i from j to N do
    a[i,j]:=elem(i,j):
od:
od:

The calculations of elements are time consuming. I want to use Threads for this purpose. Could you help me with it? Thank you.

Does anybody know why the answer of a equation i am getting on maple is coming with "eval" written?

Example:

 

the answer should be a number ...

Why does it happen?

 

 

solve the system of equations (10a+3b+4c+d+e=0,11b+2c+2d+3e+f=0,15c+4d+5e+4f+g=0,2a+b-3c+12d-3e+f+g=0,6a-5b+3c-d+17e+f=0,3a+2b-3c+4d+e-16f+2g=0,4a-6b+c+d+3e+19g=0)

I would like to express 2*sin(x+Pi/4) in the form sqrt(2)*sin(x)+sqrt(2)*cos(x). I've tried many variations using simplify/expand/combine/etc. to no avail. Any ideas?

-.733448502640020+0.*I

i am investigating above numeric

when ln(-.733448502640020+0.*I);

 

-.3099978916+3.141592654*I

it has Pi imaginary part

then 

i try 

complex(1, exp(Pi)^3);

it return Complex(...) but not 1 + i*exp(Pi)^3

 

3 means 3 times come from recursively  using pattern ln(Re(ln(x) - 3.141592654*I))

3.141592654 in imaginary part appear 3 times

i use Round(Im(x), 8) during above operation

 

 actually i want to extract Pi imaginary part from -.733448502640020+0.*I

 

however, after minus exp(Pi) from it first time,

it is near the original number  -.733448502640020

is this elimination of imaginary part is just a illusion from log function?

I have the  following simple code in Maple:

x:=2*y

save x, "file1.mpl";

This code works successfully in Maple 13 and 14. However, does not work in Maple 17.  I do not understand why this happens. Can anyone help me to save a procedure in Maple 17.

 

First 1476 1477 1478 1479 1480 1481 1482 Last Page 1478 of 2434