Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 36 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@still0fthenight Many responders here are happy to help students with their homework if they have shown some effort, and you have clearly shown some effort. Now how about uploading that code?

@mapleus 

Like I said in the Answer, I needed to adjust the precision control after you filled in the signum. I've done this by using the option relerr= 1e-10 in dsolve and setting Digits:= 7 before doing the fsolve. This assumes that knowing X to seven digits is sufficient for your purposes.


restart:

F:= 1:  l:= 1:  a:= 0.1:  n:= 4.5:  B:= 1.47e-11:
J_nc:= evalf(2*a*int(y^(1/n+1),y=0..a/2)):
M_f:= z-> piecewise(
     z>=0 and z<=l, F*l,
     z>l and z<=2*l, F*l-F*(z-l),
     z>2*l and z<=3*l, F*l-F*(z-l)+F*(z-2*l)
):
'M_f'(z) = M_f(x); #for display only
M_ed:= z-> z-3*l:
M_x:= z-> M_f(z)+X*M_ed(z);
eq:= diff(V(z),z$2) = B*(abs(M_x(z))/J_nc)^n*signum(M_x(z));
cond:= V(0) = 0, D(V)(0) = 0:

sol_2:= dsolve({cond, eq}, numeric, parameters= [X], relerr= 1e-10):
sol_3:= proc(X)
     sol_2(parameters= [X]);
     eval(V(z), sol_2(3*l))
end proc:

Digits:= 7:
sol_X:= fsolve(sol_3);
plot(eval(M_x(z), X= sol_X), z= 0..3*l);

M_f(z) = piecewise(0 <= x and x <= 1, 1, 1 < x and x <= 2, 2-x, 2 < x and x <= 3, 0)

M_x := proc (z) options operator, arrow; M_f(z)+X*M_ed(z) end proc

diff(diff(V(z), z), z) = 7647603.*abs(piecewise(0 <= z and z <= 1, 1, 1 < z and z <= 2, 2-z, 2 < z and z <= 3, 0)+X*(-3+z))^4.5*signum(piecewise(0 <= z and z <= 1, 1, 1 < z and z <= 2, 2-z, 2 < z and z <= 3, 0)+X*(-3+z))

.3490381

 


Download dsolve_piecewise.mw

@itsme I'd be even more careful with the cutting and pasting. I might occasionally cut and paste from a 2d output (aka prettyprinted) region to a 1D input region (the only input I use) in order to inspect the internal structure of something (although I'm more likely to use lprint(%) for that); but I would never assume that the result of doing that is equivalent to some previous input.

@maple fan I'm having some trouble following this thread. Are you saying that you doubt that cos(70) = 0.633319 to six decimal places?! Any scientific pocket calculator can tell you that that's correct. Do you doubt Kitonum's result that that value can be obtained using 122 terms of the series and 40 digits precision?

@ilia_mahan No one can help you because "simplify [expression A] according to [expression B]" doesn't mean anything in mathematical English (except possibly in the case where we assume that B is 0, but that is clearly not what you mean by it). Perhaps if you provided a few simple examples of one expression being "simplified according to" another expression, we could figure it out from there.

@Axel Vogt Surely you intended to say "any piecewise constant function" instead of "any piecewise function".

@Andriy Nothing unusual is happening for you. That's just the way 2D-Math "works"---another reason to not use it. This is why you see so many posts on MaplePrimes where plaintext code looks like a solid block with no line breaks.

@ANANDMUNAGALA If you had that procedure, why did you ask this Question?

If you could point me to a web-based discussion of the algorithm, I may be able to code it in Maple.

@ANANDMUNAGALA Please submit a Maple file, not a Word file!

@ANANDMUNAGALA There is no file. Please try uploading again.

@NicholasMarrone Your worksheet failed to attach. Please try again.

The OP's Question is specifically about cutting and pasting code from Maple IDE to plaintext. Maple IDE is a separately sold GUI to Maple for large-scale code development (see http://www.maplesoft.com/products/toolboxes/IDE/). So, the OP's Question has nothing to do with cutting and pasting from Maple's Standard GUI (in 1D- or 2D-input form) or Classic GUI. 

I ask the OP: Why do you want to copy to Notepad? Doesn't the IDE provide everything that you need for editing plaintext Maple files?

I don't use the IDE so I don't know the following: Does the IDE have an Export to plaintext command? Does it store your Maple code files in plaintext form? 

The MaplePrimes's Question headers should be updated to include Maple IDE as one of the product choices.

 

@bogo No, evalhf is not what you need; fnormal is what you need. With evalhf you have no control over the magnitude below which numbers become zero.

evalhf(1e-87);

fnormal(1e-87, 50);

     0.

The 50 is to set the precision. With this setting, any value with magnitude lower than 1e-48 is set to zero.

The only reason that I brought up evalhf was to explain that some small numbers would be automatically converted to zero.

@Markiyan Hirnyk Your advice about interface(displayprecision= ...) needs a proviso/warning: This only affects the way that the numbers are displayed; it does not change the way that they are stored or how they are used in computations. The other command, fnormal, does change the way that a number is stored and used.

First 497 498 499 500 501 502 503 Last Page 499 of 709