## 2 Badges

10 years, 111 days

## @Markiyan Hirnyk    I didn't u...

I didn't understand that answer enough.
Now I see that I have to use after M(x):=M(x)*(-EI);

M(x):=convert(%, piecewise, x);

Thanks for your help,

## Re: Workaround...

@Kitonum

Thanks a lot for your help.
I don't quite understand what/why you are doing that convert(.... , ... , x) trick but the result looks a lot better than before.
There is stil an "L" in the conditions, can be removed?

## Your code in Maple 17...

@Preben Alsholm

Hello Preben,

Thanks a lot for your help!

Below your sample code in Maple 17:

## That's a long story...

Hello Preben,
Below i pasted my code, but I don't know how to avoid these [].

# How to get [square brackets]...
restart:
# Some functions of previous math.
Mf(x) := piecewise(x <= (1/2)*L, (1/2)*x*F, (1/2)*L < x, (1/2)*x*F-F*(x-(1/2)*L));
W(x)  := (1/6)*(-(4*(alpha-1))*b(0)*(x-(1/2)*L)^2/L^2+alpha*b(0))^2*h;
# Calculate the stress with the formula σ=M/W:
sigma[F](x):=Mf(x)/W(x);
sigma[F](x):=simplify(sigma[F](x));
# Make function σ[F](ξ), divide by (F*L/(h*b(0)^2)) and substitute x=ξ*L :
eq[1]:=sigma[F](xi)*(F*L/(h*b(0)^2))=sigma[F](x);
sigma[F](xi):=solve(eq[1],sigma[F](xi));
sigma[F](xi):=subs(x=xi*L,sigma[F](xi));
sigma[F](xi):=factor(sigma[F](xi));
# Remove the "L" on both sides of te unequeation:
sigma[F](xi):=eval(sigma[F](xi),L=1); # L>0

## How to print the piecewise function / []...

@Preben Alsholm

Hello Preben,

Now the function won't print. Maple says "~unable to evaluate the function to numeric values in the region~"
I think it has something to do with the square brackets [ and ] is there a way to let maple remove them or another way to get a print?
FuncA is the result of my calculation, FuncB is typed manually without the square brackets.

restart:
FuncA:=piecewise(xi <= (1/2),[xi^2+6],(1/2)< xi,[-xi^2-6],[0]);
plot(FuncA);
FuncB:=piecewise(xi <= (1/2),xi^2+6,(1/2)< xi,-xi^2-6,0);
plot(FuncB);

## unequeation part of piecewise function...

Hello Preben,
Yes, L is positive (Length of a beam)
Thanks for your answer, but I think I told only half the story.
What if the unequeation is part of a piecewise function.
Can you give me some tips how to handle this?

Funct:=piecewise(xi*L<=L/2,x^2,L/2>xi*L,x);
simplify(Funct) assuming L>0;

 Page 1 of 1
﻿