Items tagged with piecewise piecewise Tagged Items Feed

Hi all;

Hope all of you  be in good health

I want to construct a special function b_{nm}(t) like:

with piecewise command i did it but the result is incorrect.

any one can help me to do it?

Best wishes

 

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Hello,

I have to simplify a piecewise function and Maple gets a more complicated solution than needed.




I don't know how to handle this kind of problems with Maple?
I don't understand why Maple doesn't see this?
Am I doing something wrong?

Thanks in advance for your help / advice.


# the code of my example
restart:
Mf(x):=piecewise(x<=L/2,1/2*x*F,x>1/2*L,1/2*x*F-F*(x-1/2*L));
# Make a dimensionless function:
# -    Mf(x):= Mf(xi)*F*L
# -    variable ξ  ( xi:=x/L )
eq[1]:=Mf(xi)*F*L=Mf(x);
Mf(xi):=solve(eq[1],Mf(xi));
Mf(xi):=subs(x=xi*L,Mf(xi));
# F is the Force and L is the Length of the beam:
Mf(xi):=simplify(Mf(xi)) assuming F>0,L>0;
print("When I simplify this function by hand it will be");
Mf(xi):=piecewise(xi<=1/2,1/2*xi,xi>1/2,-1/2*xi+1/2);




Hi all,
I need to find mina(w) then a=-1,0,1 and

w := piecewise((x-a)/t <= -10, 202*a-200*x-(202001/101)*t, (x-a)/t <= -910/101, 3*a-x-(1011/101)*t, (x-a)/t <= 910/101, 2*a-t, (x-a)/t <= 10, a+x-(1011/101)*t, 10 < (x-a)/t, -198*a+200*x-(202001/101)*t)

Also need to plot it, i think it should look like this 

Thanks

 

 

 

Dear All,

 

I would like perform a symbolic integration to the following integrand with Heaviside function:

 

The integral I defined is as follows:

The output I got is

 

Could any one explain me how to avoid the undefined in the output. I tried to define the assumtions to constrain the solution. However, I failed to supress the undefined.

I expect a result of the integration should also be piecewise function.

 

Appreciate you constructive inputs.

 

Thanks!

 

 

Hello fellow maple fans :)

 

I have tried to plot this continuous Piecewise function

plot(piecewise(0 <= t and t < 2, 2-t, 2 <= t and t <= 3, 2*t-4))

On the interval [0,6]

When i try it plot it it won't show the entre internal, is there a way to tell maple that the funktion should continuous until [0,6]

Please see this http://snag.gy/NPrjG.jpg if you are not sure what i mean in the end it should look like this http://snag.gy/ScgtF.jpg

Greetings David Thanks in advance :)

 

Hi MaplePrime-ers!

I've been using the Maple(17) toolbox in Matlab(2012b) to quickly enumerate systems of equations by: (i) solving them symbolically, (ii) using unapply to make them functions, (iii) then supplying the points (driver equations) to get the system solution.  Speed is a must, because there may be 3 million+ systems to solve.  Symbolics is also very important because I am evaluating topology, so the structure of the equations may change, and therefore a functional approach will not work.

I have had success (seen in the first code snippet).  I would like similiar behaviour in the second code snippet, but sometimes I get 'solutions may be lost' as an error message,  or 'Error, (in unapply) variables must be unique and of type name'

The system of equations include:  Linear equations, 5th order polynomials, absolute functions, and pieceiwse functions.

Here is code with a topology that solves:

#Interconnection Equations
eq2[1] := FD_T + EM2_T = 0;
eq2[2] := ICE_T + GEN_T = 0;
eq2[3] := EM2_A + GEN_A + BAT_A = 0;
eq2[4] := -FD_W + EM2_W = 0;
eq2[5] := -ICE_W + GEN_W = 0;
eq2[6] := -EM2_V + GEN_V = 0;
eq2[7] := -EM2_V + BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#ASSUMPTIONS
assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

#FINAL EQUATIONS

sys_eqs2 := convert(eq2,set) union {eq_c[1],eq_c[2],eq_c[3],eq_c[4],eq_c[5],eq_c[6]};

#Selecting which variables to solve for:

drivers2:= { ICE_T,ICE_W,FD_T,FD_W};
symvarnames2:=select(type,indets(convert(sys_eqs2,list)),name);
notdrivers2:=symvarnames2 minus drivers2;


#Symbolic solve

sol2:=solve(sys_eqs2,notdrivers2) assuming real:
symb_sol2:=unapply(sol2,convert(drivers2,list)):


#Enumerate (there will generally be about 40, not 6)

count := 0;
for i1 from 1 to 40 do
     for i2 from 1 to 40 do
          for i3 from 1 to 40 do
               for i4 from 1 to 40 do
                    count := count + 1;
                    solsol2(count) := symb_sol2(i1,i2,i3,i4);
               od;
          od;
     od;
od;
count;



This works great!  I would like simliar output in my second code snippet, but this time with more inputs to symb_sol.  However, if I try and change the interconnection equations a little, and add a piecewise function, and another driver... (differences in bold)

#Interconnection Equations
eq1[1] := FD_T+EM2_T = 0;
eq1[2] := ICE_T+GBb_T = 0;
eq1[3] := GEN_T+GBa_T = 0;
eq1[4] := EM2_A+GEN_A+BAT_A = 0;
eq1[5] := -FD_W+EM2_W = 0;
eq1[6] := -GEN_W+GBa_W = 0;
eq1[7] := -ICE_W+GBb_W = 0;
eq1[8] := -EM2_V+GEN_V = 0;
eq1[9] := -EM2_V+BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#GB
FiveSpeedGearbox_R := proc(ig)
local i ,eq;
i[1]:=3.32;
i[2]:=2;
i[3]:=1.36;
i[4]:=1.01;
i[5]:=0.82;
eq:= piecewise(ig=1,i[1],ig=2, i[2],ig=3,i[3],ig=4,i[4],ig=5,i[5],1);
return eq(ig);
end proc;


eq_c[7] := GBb_T = -1/GB_R * GBa_T;
eq_c[8] := GBb_W = GB_R * GBa_W;
eq_c[9] := GB_R = FiveSpeedGearbox_R(ig);

 

#System Equations
sys_eqs := convert(eq1,set) union convert(eq_c,set);

 

 #Solve for variables
symvarnames:=select(type,indets(convert(sys_eqs,list)),name);
drivers:= {ig, ICE_T,ICE_W,FD_T,FD_W};
not_drivers := symvarnames minus drivers;

#Assumptinons

assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

sol:=(solve(sys_eqs,not_drivers) assuming real);

symb_sol:=unapply(sol,convert(drivers,list)): ---> Error, (in unapply) variables must be unique and of type name

Subsequent parts don't work...

count := 0;
for i1 from 1 to 40 do
     for i2 from 1 to 40 do
          for i3 from 1 to 40 do
               for i4 from 1 to 40 do
                    for i5 from 1 to 40 do
                         count := count + 1;
                         solsol2(count) := symb_sol2(i1,i2,i3,i4,5);
                    od;
               od; 
          od;
     od;
od;
count;

While running the last line sol:, 1 of 2 things will happen, depending on the solver. Maple17 will take a long time (30+ minutes) to solve, then report nothing, or sol will solve, but will report "some solutions have been lost".

Afterwards, evaluating symb_sol(0,0,0,0,0) will return a viable solution (real values for each of the variables).  Whereas evaluating symb_sol(0,X,0,0,0), where X <> 0, will return and empty list [].

Does anyone know how to (i) speed up the symbolic solve time?  (ii) Return ALL of the solutions?

 

Thanks in advance for reading this.  I've really no idea why this isn't working.  I've also attached two worksheets with the code: noGB.mw   withGB.mw

 Adam

I've been poking around with convolutions on Maple, and some weird behavior came up---if I let it compute the convolution of a piecewise function, then take the convolution of that, it comes out differently than if I enter a function from scratch as the middle step---file attached (PiecewiseProblem.mw).  I'm not really a Maple pro, so am I'm doing something crazy here?

Thanks!

hello, how to write this system?

> restart;
> x10:=0.2; x20:=0.4; U0:=0.25;
> eq3 :=subs(U(t)=(piecewise(U(t)<=0,0,U(t)>=1,1,U(t))),(1/4)*(U(t)^2*x1(t)-2*U(t)*x1(t)*sqrt(x2(t))-U(t)^2*x2(t)+2*U(t)*x2(t)*sqrt(x1(t))-2*(diff(U(t), t))*x1(t)^(3/2)*U(t)+4*(diff(U(t), t))*x1(t)^(3/2)*sqrt(x2(t))+2*(diff(U(t), t))*x2(t)^(3/2)*U(t)-4*(diff(U(t), t))*x2(t)^(3/2)*sqrt(x1(t)))/(x1(t)^(3/2)*x2(t)^(3/2)));
> sys := eq3=0, diff(x1(t), t) = (piecewise(U(t)<=0,0,U(t)>=1,1,U(t)))-sqrt(x1(t)), diff(x2(t), t) = (piecewise(U(t)<=0,0,U(t)>=1,1,U(t)))-sqrt(x2(t));
> dsolve({sys,x1(0)=x10,x2(0)=x20,U(0)=U0},{x1(t),x2(t),U(t)},type=numeric);

 

Male produces an error: Error, (in DEtools/convertsys) invalid input: eval expects its 2nd argument, eqns, to be of type {integer, equation, set(equation)}, but received newdeqns

such as the list [[0,2],[3,-2],[7,6],.....,[x,y]]

and change to piecewise 

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;

Hi all

I have following program to solve time delay system...

the solution is good by choosing r:=11... but for r greater than 11(e.g r=20) the system take about4-5 minute to do and then it says:"" K2:=simplify(inverse(K1)):Error, (in minor) object too large""
and for plotting says:""     Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct""

i don't know what is the problem?

any one can help me???

best wishes

 

> restart:
> with(plots):
> with(linalg):
> with(LinearAlgebra):
> L:=1:
> r:=20:
> tau:=0.3:
> #definition of exact solution
>
> T1 := piecewise(t<0,0,t>=0 and t<0.3,1+t^2,t>=0.3 and t<0.6,(691/1000)+(109/100)*t+(7/10)*t^2+(1/3)*t^3,0.6<=t and t<0.9,(4409/5000)+(209/500)*t+(69/50)*t^2+(2/15)*t^3+(1/12)*t^4,0.9<=t and t<1,(1500917/2000000)+(35107/40000)*t+(1617/2000)*t^2+(87/200)*t^3+(1/120)*t^4+(1/60)*t^5):
> plot(T1,t=0..1,numpoints=10000,discont = true):
> g:=t^2:
> a[0]:=evalf((1/L)*Int(g,t=0..L)):
> for i1 from 1 to r do
> a[i1]:=evalf((2/L)*Int(g*cos(2*i1*Pi*t/L),t=0..L)):
> od:
> for j1 from 1 to r do
> b[j1]:=evalf((2/L)*Int(g*sin(2*j1*Pi*t/L),t=0..L)):
> od:
> X00:=matrix([[a[0]]]);
> X10:=matrix(1,r,0):
> for j from 1 to r do
> X10[1,j]:=a[j]:
> od:
>
> X20:=matrix(1,r,0):
> for j from 1 to r do
> X20[1,j]:=b[j]:
> od:

X00 := [0.3333333333]

> X00:=blockmatrix(1,3,[X00,X10,X20]):
>
>
>
> Z:=linalg[matrix](2*r+1,2*r+1):
> Z[1,1]:=tau:
> for iz from 2 to r+1 do
> Z[iz,1]:=(L/(2*(iz-1)*Pi))*sin(2*(iz-1)*Pi*tau/L):
> od:
> for iz from r+2 to 2*r+1 do
> Z[iz,1]:=(L/(2*(iz-1-r)*Pi))*(1-cos(2*(iz-1-r)*Pi*tau/L)):
> od:
> for jz from 2 to 2*r+1 do
> for iz from 1 to 2*r+1 do
> Z[iz,jz]:=0;
> od:
> od: 
> Dtau00:=matrix([[1]]):
> Dtau01:=matrix(1,r,0):
> Dtau02:=matrix(1,r,0):
> Dtau10:=matrix(r,1,0):
> Dtau20:=matrix(r,1,0):
>
> Dtau1:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau1[i,i]:=cos(2*(i)*Pi*tau/L):
> if i<>j then Dtau1[i,j]:=0 fi:
> od:
> od:
>
> Dtau2:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau2[i,i]:=sin(2*(i)*Pi*tau/L):
> if i<>j then Dtau2[i,j]:=0 fi:
> od:
> od:
>
> Dtau3:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau3[i,i]:=-sin(2*(i)*Pi*tau/L):
> if i<>j then Dtau3[i,j]:=0 fi:
> od:
> od:
>
> Dtau4:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> Dtau4[i,i]:=cos(2*(i)*Pi*tau/L):
> if i<>j then Dtau4[i,j]:=0 fi:
> od:
> od:
>
> Dtau:=blockmatrix(3,3,[Dtau00,Dtau01,Dtau02,Dtau10,Dtau1,Dtau2,Dtau20,Dtau3,Dtau4]):
>
> P00:=matrix([[L/2]]):
> P01:=matrix(1,r,0):
>
> P02:=matrix(1,r,0):
> for j from 1 to r do
> P02[1,j]:=-L/(j*Pi):
> od:
>
> P10:=matrix(r,1,0):
>
> P20:=matrix(r,1,0):
> for i from 1 to r do
> P20[i,1]:=L/(2*i*Pi):
> od:
>
>
> P1:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P1[i,j]:=0
> od;
> od;
> P2:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P2[i,i]:=L/(2*i*Pi):
> if i<>j then P2[i,j]:=0 fi:
> od:
> od:
>
> P3:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P3[i,i]:=-L/(2*i*Pi):
> if i<>j then P3[i,j]:=0 fi:
> od:
> od:
>
> P4:=linalg[matrix](r,r):
> for i from 1 to r do
> for j from 1 to r do
> P4[i,j]:=0:
> od:
> od:
>
> P:=blockmatrix(3,3,[P00,P01,P02,P10,P1,P2,P20,P3,P4]):
> I1:=Matrix(2*r+1,shape=identity):
> K1:=simplify(evalm(I1-Dtau&*P+Dtau&*Z)):
> K2:=simplify(inverse(K1)):
Error, (in minor) object too large

>
> X0:=matrix(1,2*r+1,0):
> X0[1,1]:=1:
> for j from 2 to 2*r+1 do
> X0[1,j]:=0:
> od:
>
> X:=simplify(evalm(evalm((X0+X00))&*K2)):
>
> for h from 1 to r do
> f1(h):=cos(2*h*Pi*t/L):
> od:

> for k from 1 to r do
> f2(k):=sin(2*k*Pi*t/L):
> od:
> XP:=X[1,1]+evalf(sum(X[1,l+1]*f1(l)+X[1,r+l+1]*f2(l),l=1..r )):
> plot({XP,T1},t=0..1);
Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

Hi everyone

I'd be pleased if you could give a hand with the exploration assistant.

 

1. I want the exploration assistant to appear on the same document I am working on, but everytime I use it (either by right-clicking or by the explore command) it automatically appears on a new document.

 

2. can I manipulate a piecewise function when using embedded components? i.e.: plot the function and varying the parameters using sliders.

 

thanks

cesar

Please have a visit of this qestion `http://math.stackexchange.com/q/574843/8581`. I did a very elementary attempt there for example for a function:

 > with(plots):
      h := x->piecewise(x < -2, x+3, x <= 2, 5-x^2, 3-x):
      t:=x->h(-x):
      a:= plot(h(x), x = 0 .. 10, color = red, thickness = 3):
      b:= plot(t(x), x = -10 .. 0, color = green, thickness = 3):
      display(a,b);

But  I am eager to know  the formal codes if they exists. Thanks for your time.

i have a piecewise like " g "

g := piecewise(0 <= t and t <= 0.2e-1, 122.63, 0.2e-1 < t and t < .287, 0, .287 <= t and t <= .307, 122.63, .307 < t and t < .335, 0); plot(g, t = 0 .. .335)

this function is semi periodic just for 10 times consecutive . i want to define it

example     k=[g g g g g g g g g g  g ] or somthing like that.

 

1.mw 

 

i want to plot fft form of final piecewise function

and then filter it . and plot them.

hi maplefriends, i´m trying to solve a piecewise funtion, and gold is find the maximum and  location, for that i use de package Maximize.unfortunately the result i have is the local maximum, can anyone show me, how can i do that? >  >  Download maximize_abs.mwbest regards
1 2 3 4 5 Page 1 of 5