MaplePrimes Questions

This one really has me baffled.

What the proc does is not important. This is just about as simple an example as I could write. Maple 2015 is complaining anytime I try to declare a local variable. The second example shows that the local declaration is needed - Maple even introduces it into the procedure that it defines.

restart;
test := proc(  )
local a;
a := 3
end proc;
Error, unexpected `local` declaration in procedure body
test := proc(  )
# local a;
a := 3
end proc;
Warning, `a` is implicitly declared local to procedure `test`
test := proc(x) local a; a := x end proc

Here's the version information for my current Maple.

interface( version );
Standard Worksheet Interface, Maple 2015.0, Windows 7, February 17 2015 Build ID 1022128

Can someone explain what is happening, and why I'm just now seeing this?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Hello,

I would like to build a periodic curve but starting from a parametric curve and not with a function.

Thanks to you tips, I could obtain a periodic function with a piecewise function starting from a function (http://www.mapleprimes.com/questions/208795-Periodic-Piecewise-Function)

I would like to do the same approach but starting from this parametric curve f :

V:=Vector([cos(t),sin(t)]);
f:=unapply(V, t);
plot( [f(t)[1],f(t)[2], t = 0..evalf(Pi)],color=red, scaling=constrained);

And I would like to build a periodic curve (the period is defined on the x axis) g such as :

 

Unfortunately, the approach presented in the post http://www.mapleprimes.com/questions/208795-Periodic-Piecewise-Function does'nt work anymore.

Do you have ideas to build this periodic curve starting from the parametric curve defined above ?

The aim of my question is more linked to the methodolody than the result.

Thank you for your help.

A lot of my life is at the moment spent using solve to solve systems of equations, and then trying to weed through the solutions maple gives to find the ones I am interested in. Specifically i'd like to have a program that can weed through the solutions and eliminate those that include equalities of the  form p[i]=-p[j] or p[i]=0  where i and j are integers (or equalities of that form with the letter q replacing p). Specifically i don't want to exclude equalities of the form p[i]=-p[j]*something+something else-another thing.... as they can be useful (or equalities of that form with the letter q replacing p).

Here is a (simple) example of the kind of equations I am likely to be solving and their output from solve:
A := solve([p[1]*p[2]*p[3] = q[1]*q[2]*q[3], p[1]+p[3] = q[1]+q[3], p[2]^2+p[3]^2 = q[2]^2+q[3]^2])

I have some code which gets rid of solutions where one variable is set to 0 

with(ArrayTools);
GetRidOfDumbSolutions := proc (sols)
local Nsols, Npars, GoodSol, GoodSols, GoodSolsCounter, i, j;
Nsols := numelems(sols); Npars := numelems(sols[1]);
GoodSols := []; GoodSolsCounter := 0;
for i to Nsols do
GoodSol := 1;
for j to Npars do
if IsZero(rhs(sols[i, j]))
then GoodSol := 0
end if
end do;
if GoodSol = 1 then
GoodSols := Concatenate(1, GoodSols, sols[i])
end if
end do;
GoodSols
end proc

but i can't see how (in maple) to detect an expression of the form p[i]=-p[j] especiall if that is being written in 2-d math. (i don't quite understand the different maths environments or how to convert from one to another or to string)

Good Morning,

This is the script that I have used to to an integration, as the command ''int'' didn't work because the coputation was really heavy.


p_old := 0;

g := 0; #index

E_tot_net_Point := 0;

for g to 2 do

 h := g+1;

 loopstart := SP_time[g];

 loopend := SP_time[h];

  for tt from loopstart by 0.01 to loopend do

   t := tt;

   P_tot_net_Fkt := t -> C_motore[g]*omega_motore[g]

if t≠SP_time[g] and t ≠ SP_time[h] then

 P_tot_net_Point := P_tot_net_Fkt(t);

 P_tot_net_Point_next := P_tot_net_Fkt(t+0.001);

 plt_P_tot_net_plt[t] := pointplot([t, P_tot_net_Point]);

 E_tot_net_Point := E_tot_net_Point+(P_tot_net_Point*0.01);

 plt_E_tot_net_plt[t] := pointplot([t, E_tot_net_Point]);

 p_old := P_tot_net_Point;

end if;      

  end do:

end do:

plots:-display(entries(plt_E_tot_net_plt, 'nolist'), title = "Energy", color = "Red", symbol = point, symbolsize = 20, gridlines = true, size = [1000, 500], labels = ['[s]', '[Watt*s]'], font = [axes, 12])


I have plotted the function as a series of points over the orizontal axis (t).

 

Now I would like to calculate the last value of the curve (which is itself a point) as a function of the orizontal axes t. How can I do it?

Something like E_tot_net_Point = f(t)

 

Thank you for the help

                                                                                                                                         

I have a maple homework on the collatz conjecture, but i am new to maple and does not know how to program it.

our professor gave us the first part, i tried a lot of different loop, but keep getting errors. Need HELP.

I need to test all integer m <= 60, i dont know how to set up a loop that can test all 60 numbers.

> restart;

> k := proc (x) options operator, arrow; piecewise(type(x, even), (1/2)*x, 3*x+1) end proc;
/ 1 \
x -> piecewise|type(x, even), - x, 3 x + 1|
\ 2 /

> m := 3;
> k(m);
> for j to 200 while k(%) > 1 do k(%) end do;
> print(m, j+1);

 

I have a homework ask you to find the first string of (at least)10, 50, 100 consecutive composites. I have no idea how to use maple. HELP

all i can think of is 

 

>ithprime(i+1) - ithprime(i) = 10

>print(i+1, i)

 

and combine it with some loop

i dont know how to set up a loop

 need a lot of help 

I saw a presentation Calculus 1 -- I'm pretty sure it was Maple -- that showed how to set up a volume of solid of revolutionvisually rotated the region and looked at it from different points of view.

Is there someplace I could go to find out ho0w to do that.  I am new and in experienced in using Maple.

Thanks in advance.

Tim Wisecarver

Georgetown preparatory School

twisecarver@gprep.org

Hi so im trying to create a loop which allows me to find the first square after this number 
zahl:=1234567: could you guys tell me whats wrong and explain me why it is wrong, i suck at this :/

thank you so much 

zahl:=1234567:
 while sqrt(zahl)<> round(sqrt(zahl)) do  
   zahl:=zahl +1  
     if sqrt(zahl)<> round(sqrt(zahl))then  
  print(zahl):  
 end if:
 end do;

I assume that I'm not providing the correct input to the simplify command to get the simplification that I want.  In particular, for the following code:

assume(n, positive);
simplify(3^(-(1/2)*n)*2^((1/6)*n)-2^((2/3)*n)*6^(-(1/2)*n));
simplify(log(3^(-(1/2)*n)*2^((1/6)*n))-log(2^((2/3)*n)*6^(-(1/2)*n))); 

The expression should evaluate to 0.  However, the first expression does not simplify to 0 (it does not simplify at all in Maple) while the second expression simplifies to 0.

The simplification is fairly easy for the first expression by factoring 6 and combining terms; it seems like I'm not entering the command to simplify in this way.

Hai everyone

may i ask why solution have an error?

hope i have an answer

r

 

NULL

restart

with(plots):

Pr := 6.8:

Eq1 := (101-100*lambda)*(diff(f(eta), `$`(eta, 3)))+f(eta)*(diff(f(eta), `$`(eta, 2)))+2*delta*theta(eta)+2*delta*Nc*gamma(eta)-2*delta*Nr*phi(eta);

(101-100*lambda)*(diff(diff(diff(f(eta), eta), eta), eta))+f(eta)*(diff(diff(f(eta), eta), eta))+2*theta(eta)+2*gamma(eta)-2*phi(eta)

(1)

Eq2 := (101-100*lambda)*(diff(theta(eta), `$`(eta, 2)))+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*(diff(theta(eta), eta))^2;

(101-100*lambda)*(diff(diff(theta(eta), eta), eta))+6.8*f(eta)*(diff(theta(eta), eta))+3.40*(diff(theta(eta), eta))*(diff(phi(eta), eta))+3.40*(diff(theta(eta), eta))^2

(2)

Eq3 := (101-100*lambda)*(diff(phi(eta), `$`(eta, 2)))+Le*f(eta)*(diff(phi(eta), eta))+Nt*(diff(theta(eta), `$`(eta, 2)))/Nb;

(101-100*lambda)*(diff(diff(phi(eta), eta), eta))+.1*f(eta)*(diff(phi(eta), eta))+1.000000000*(diff(diff(theta(eta), eta), eta))

(3)

Eq4 := (101-100*lambda)*(diff(gamma(eta), `$`(eta, 2)))+Sc*s*(diff(theta(eta), `$`(eta, 2)))+Sc*f(eta)*(diff(gamma(eta), eta));

(101-100*lambda)*(diff(diff(gamma(eta), eta), eta))+.30*(diff(diff(theta(eta), eta), eta))+.6*f(eta)*(diff(gamma(eta), eta))

(4)

VBi := [10, 20, 30]:

etainf := 5:

bcs := f(0) = 0, (D(f))(0) = 0, (D(theta))(0) = -Bi*(1-theta(0)), phi(0) = 1, gamma(0) = 1, (D(f))(etainf) = 1, theta(etainf) = 0, phi(etainf) = 0, gamma(etainf) = 0;

f(0) = 0, (D(f))(0) = 0, (D(theta))(0) = -Bi*(1-theta(0)), phi(0) = 1, gamma(0) = 1, (D(f))(5) = 1, theta(5) = 0, phi(5) = 0, gamma(5) = 0

(5)

dsys := {Eq1, Eq2, Eq3, Eq4, bcs}:

for i to 3 do Bi := VBi[i]; dsol[i] := dsolve(dsys, numeric, continuation = lambda); print(Bi); print(dsol[i](0)) end do

Error, (in dsolve/numeric/bvp) cannot determine a suitable initial profile, please specify an approximate initial solution

 

NULL

NULL

 

Download soret.mw

 

 

I want to build a custom component by the material’s stress-strain curve ,for the component signal input is the x(t)(displacement-time curve), then I can simulate the material’s acceleration-time curve,the stress-strain equation , parameter and the custom component I built has been given in the picture,but the x(t) is same as the s[rel](t),so how to solve this problem? Thanks first.

 

 

 

 

 

Hello,

I would like to build a periodic function based on the function x-->x².

For x belonging to [0,2], the function is defined like this :

 

And for the rest of the domain in R, the function should be periodic with a period of 2.

In other words, I would like to define a function which permits me to obtain this plot :

 

Sorry, for my picture which is very ugly, but it should enable to explain what I'm looking for.

1) Is a new piecewise function based on f function is the better solution to create this kind of periodic function ?

2) I didn't find or understand with the help how i can create "infinite" piecewise function. May you help me to define this kind of piecewise function ?

Thanks a lot for your help.

P.S: With the term "nested" in my title I only want to say that I want to apply another piecewise function (for example g) on a already created function (for example f). this term may be not very appropriated.

 

 

i have run higer order nonlinear ode bvp

but cant solve the error

please help me

NULL

restart

with(plots)

Pr := .71; beta := .5; alpha := .1; S := .1; Du := .1; Nb := .1; Nt := .1; Sc := .67; Sr := .1; omega := 1.0; Lb := 1.0; Pe := 1.0; delta := 1.0; Nc := 1.0; p := .1; q := 5; r := 5; s := 5; a := 1; b := 2; epsilon := .1

Eq1 := (101-100*lambda)*(diff(f(eta), `$`(eta, 3)))-theta(eta)*beta*(diff(f(eta), `$`(eta, 2)))/(1+theta(eta)*beta)+(1+theta(eta)*beta)*f(eta)*(diff(f(eta), `$`(eta, 2)))-(1+theta(eta)*beta)*(diff(f(eta), eta))^2-(M-alpha)*(1+theta(eta)*beta)*(diff(f(eta), eta))

(101-100*lambda)*(diff(diff(diff(f(eta), eta), eta), eta))-.5*theta(eta)*(diff(diff(f(eta), eta), eta))/(1+.5*theta(eta))+(1+.5*theta(eta))*f(eta)*(diff(diff(f(eta), eta), eta))-(1+.5*theta(eta))*(diff(f(eta), eta))^2-(M-.1)*(1+.5*theta(eta))*(diff(f(eta), eta))

(1)

Eq2 := (1+epsilon*theta(eta))*(diff(theta(eta), `$`(eta, 2)))+f(eta)*(diff(theta(eta), eta))+epsilon*(diff(theta(eta), eta))^2+Pr*S*theta(eta)+Pr*Du*(diff(phi(eta), `$`(eta, 2)))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*(diff(theta(eta), eta))^2

(1+.1*theta(eta))*(diff(diff(theta(eta), eta), eta))+f(eta)*(diff(theta(eta), eta))+.171*(diff(theta(eta), eta))^2+0.71e-1*theta(eta)+0.71e-1*(diff(diff(phi(eta), eta), eta))+0.71e-1*(diff(theta(eta), eta))*(diff(phi(eta), eta))

(2)

Eq3 := (diff(phi(eta), `$`(eta, 2)))/Sc+f(eta)*(diff(phi(eta), eta))-omega*(diff(theta(eta), eta))*(diff(phi(eta), eta))-omega*(diff(theta(eta), `$`(eta, 2)))*phi(eta)-delta*phi(eta)+omega*Nc*(diff(theta(eta), `$`(eta, 2)))+Sr*(diff(theta(eta), `$`(eta, 2)))

1.492537313*(diff(diff(phi(eta), eta), eta))+f(eta)*(diff(phi(eta), eta))-1.0*(diff(theta(eta), eta))*(diff(phi(eta), eta))-1.0*(diff(diff(theta(eta), eta), eta))*phi(eta)-1.0*phi(eta)+1.10*(diff(diff(theta(eta), eta), eta))

(3)

Eq4 := diff(chi(eta), `$`(eta, 2))+Lb*f(eta)*(diff(chi(eta), eta))-Pe*(diff(phi(eta), eta))*(diff(chi(eta), eta))-Pe*(diff(phi(eta), `$`(eta, 2)))*chi(eta)

diff(diff(chi(eta), eta), eta)+1.0*f(eta)*(diff(chi(eta), eta))-1.0*(diff(phi(eta), eta))*(diff(chi(eta), eta))-1.0*(diff(diff(phi(eta), eta), eta))*chi(eta)

(4)

VM := [0., .5, 1.0]

etainf := 9

bcs := f(0) = 0, (D(f))(0) = p*(D@@2)(f)*0, theta(0) = 1+q*(D(theta))(0), phi(0) = 1+r*(D(phi))(0), chi(0) = 1+s*(D(chi))(0), D(f)*etainf = b/a, theta(etainf) = 0, phi(etainf) = 0, chi(etainf) = 0

f(0) = 0, (D(f))(0) = 0., theta(0) = 1+5*(D(theta))(0), phi(0) = 1+5*(D(phi))(0), chi(0) = 1+5*(D(chi))(0), 9*D(f) = 2, theta(9) = 0, phi(9) = 0, chi(9) = 0

(5)

dsys := {Eq1, Eq2, Eq3, Eq4, bcs}

for i to 3 do M := VM[i]; dsol[i] := dsolve(dsys, numeric, continuation = lambda); print(M); print(dsol[i](0)) end do

 

 

 

 

Hello,

I would like to build this piecewise function :

 

I try this manner :

f:=x->piecewise(x=>0 and x <= 1, x^2,x > 1 and x<=2, (2-x)^2);

But, it doesn't work. I receive the following error message :

Error, `>` unexpected

Do you have some ideas about my mistake?

Thank you for your help.

First 1176 1177 1178 1179 1180 1181 1182 Last Page 1178 of 2434