Iza

35 Reputation

4 Badges

8 years, 169 days

MaplePrimes Activity


These are questions asked by Iza

Hello,

I use a map() command to get the values of function for each element of vector. Here is an example of a simple task:

restart:

A:=[1,2,8];

f1:=x->2*x;
f1_table_A:=Vector([map(f1,A)]);

I would like to do the same with piecewise function but it doesn't work. Here is an example:

restart:
with(plots):
f:=2*x:
g:=x^2:

h:=x->piecewise( 0<=x and x<= 5, f, 5<x and x <= 10, g ) ;
A:=[1,2,8]:
h_table_A:=map(h,A):

Is it possible to work with piecewise function? Maybe someone has an idea how to do it in different way?

Kind regards,

Iza

Hallo,

I am rather a beginner in Maple, so I will be grateful for understanding.

I try to solve the equation with one unknown. To create this equation I firstly had to solve the set of four equations so it is very complicated. Maple is able to create the plot of it but command fsolve is not sufficient to solve it. Here is my procedure:

restart:
z1:=H/mg*cosh(mg/H*(x+C11))-C21:
z2:=H/mg*cosh(mg/H*(x+C12))-C22:
tg_alpha1:=diff(z1,x):
tg_alpha2:=diff(z2,x):
r1:=H*subs(x=xP,tg_alpha2)-H*subs(x=xP,tg_alpha1)-P:
r2:=subs(x=0,z1):
r3:=subs(x=l,z2)-h:
r4:=subs(x=xP,z1)-subs(x=xP,z2):
mg:=2:l:=20:h:=5:xP:=l/5:P:=10:
C := solve({r1, r2, r3, r4}, {C11, C12, C21, C22}):
s1 := int(sqrt(1+(diff(subs(C, z1), x))^2), x):
s2 := int(sqrt(1+(diff(subs(C, z2), x))^2), x):
s := subs(x = xP, s1)-subs(x = 0, s1)+s2-subs(x = xP, s2):
eq1 := l0-subs(x = l, s):
l0 := 40:
plot(eq1, H=10 .. 11, colour = red);
H := fsolve(eq1 = 0, H = 10.7 .. 10.8);

I would be grateful for any help and indicating my mistakes.

Thanks

Iza

1 2 Page 2 of 2