Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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

This post is my attempt to answer the question from   here : how to find all integer points (all points with integer coordinates) in the intersection of two cubes. The following procedure  IntegerPoints  solves a more general problem: it finds all the integer points of a bounded polyhedral region of arbitrary dimension, defined by a system of linear inequalities and / or equations.

Required parameters of the procedure: SN is a set or a list of linear inequalities and/or equations with any number of variables, the Var is the list of variables. The procedure returns the set of all integer points, satisfying the conditions  SN .

Code of the procedure:

restart;

IntegerPoints := proc (SN::{list, set}, Var::list)

local SN1, sn, n, Sol, k, i, s, S, R;

uses PolyhedralSets, SolveTools[Inequality];

SN1 := convert(evalf(SN), fraction);

for sn in SN1 do

if type(sn, `<`) then SN1 := subs(sn = (`<=`(op(sn))), SN1)

end if; end do;

if IsBounded(PolyhedralSet(SN1)) = false then error "The region should be bounded" end if;

n := nops(Var);

Sol := LinearMultivariateSystem(SN, Var);

if Sol = {} then return {} else

k := 0;

for s in Sol do if nops(indets(s[1])) = 1 then

S[0] := [[]];

for i to n do

S[i] := [seq(seq([op(j1), op(j2)], j2 = [isolve(eval(s[i], j1))]), j1 = S[i-1])] end do;

k := k+1; R[k] := op(S[n]);

end if; end do;

convert(R, set);

map(t->rhs~(t), %);

end if;

end proc:

 

Examples of use:

IntegerPoints({x > 0, y > 0, z > 0, 2*x+3*y+z < 12}, [x, y, z]);

       

  {[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 1, 4], [1, 1, 5], [1, 1, 6], [1, 2, 1], [1, 2, 2], [1, 2, 3], [2, 1, 1], [2, 1, 2],

                                   [2, 1, 3], [2, 1, 4], [2, 2, 1], [3, 1, 1], [3, 1, 2]}

 

IntegerPoints({x > 0, y > 0, z > 0, 2*x+3*y+z = 12}, [x, y, z]);

                                    {[1, 1, 7], [1, 2, 4], [1, 3, 1], [2, 1, 5], [2, 2, 2], [3, 1, 3], [4, 1, 1]}

 

IntegerPoints([x > 0, y > 0, z > 0, 2*x+3*y+z = 12, x+y+z <= 6], [x, y, z]);

                                                           {[1, 3, 1], [2, 2, 2], [4, 1, 1]}

isolve({x > 0, y > 0, z > 0, 2*x+3*y+z < 12});  #  isolve fails with these examples

              Warning, solutions may have been lost

isolve({x > 0, y > 0, z > 0, 2*x+3*y+z = 12});

              Warning, solutions may have been lost

 

In the following example (with a visualization) we find all integer point in the intersection of a square and a triangle:

S1 := {x > 0, y > 0, x < 13/2, y < 13/2}:

S2 := {y > (1/4)*x+1, y < 2*x, y+x < 12}:

S := IntegerPoints(`union`(S1, S2), [x, y]):

Region := plots[inequal](`union`(S1, S2), x = 0 .. 7, y = 0 .. 7, color = "LightGreen", nolines):

Points := plot([op(S)], style = point, color = red, symbol = solidcircle):

Square := plottools[curve]([[0, 0], [13/2, 0], [13/2, 13/2], [0, 13/2], [0, 0]], color = blue, thickness = 3):

Triangle := plottools[curve]([[4/7, 8/7], [4, 8], [44/5, 16/5], [4/7, 8/7]], color = blue, thickness = 3):

plots[display](Square, Triangle, Points, Region, scaling = constrained);

                                           

 

 

In the following example (with a visualization) we find all integer point in the intersection of two cubes. The second cube is obtained from the first cube by rotation with orthogonal matrix  A  and by a translation:

A := <1/3, 2/3, 2/3; -2/3, 2/3, -1/3; -2/3, -1/3, 2/3>:

f := unapply(A^(-1).<x+5, y-4, z-7>, x, y, z):

S1 := {x > 0, y > 0, z > 0, x < 6, y < 6, z < 6}:

S2 := eval(S1, {x = f(x, y, z)[1], y = f(x, y, z)[2], z = f(x, y, z)[3]}):

S := IntegerPoints(`union`(S1, S2), [x, y, z]);

Points := plots[pointplot3d](S, color = red, symbol = box):

Cube := plottools[cuboid]([0, 0, 0], [6, 6, 6], color = blue, linestyle = solid):

F := plottools[transform]((x, y, z)->convert(A.<x, y, z>+<-5, 4, 7>, list)):

plots[display](Cube,  F(Cube), Points, scaling = constrained, linestyle = solid, transparency = 0.7, orientation = [25, 75], axes = normal);

 

 

 

In the example below, all the ways to exchange $ 1 coins of 1, 5, 10, 25 and 50 cents, if the number of coins no more than 8, there is no pennies and there is at least one 50-cent coin:

IntegerPoints({x1 = 0, x2 >= 0, x3 >= 0, x4 >= 0, x5 >= 1,  x1+5*x2+10*x3+25*x4+50*x5 = 100, x1+x2+x3+x4+x5 <= 8}, [x1, x2, x3, x4, x5]);

nops(%);

                              {[0, 0, 0, 0, 2], [0, 0, 0, 2, 1], [0, 0, 5, 0, 1], [0, 1, 2, 1, 1], [0, 2, 4, 0, 1],

                                                 [0, 3, 1, 1, 1], [0, 4, 3, 0, 1], [0, 5, 0, 1, 1]}

                                                                                    8

 

Integer_points.mw

 

Addition: Below in my comments another procedure  IntegerPoints1  is presented that solves the same problem.

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 1151 1152 1153 1154 1155 1156 1157 Last Page 1153 of 2224