Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 306 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

restart:
Eckert:= 0.5:
sigma:= 15:

eq1:= diff(f(eta), eta)^2-f(eta)*diff(f(eta), eta$2) =
diff(f(eta), eta$3)+k_1*(2*diff(f(eta), eta)*diff(f(eta), eta$3)
+diff(f(eta), eta$2)^2-f(eta)*diff(f(eta), eta$4)):

N:= 10:
bcs1:= f(0) = 0, D(f)(0) = 1, D(f)(N) = 0, (D@@2)(f)(N) = 0:

eq2:= diff(theta(eta), eta$2)+sigma*f(eta)*diff(theta(eta), eta) +
sigma*Eckert*(diff(f(eta), eta$2)^2+k_1*diff(f(eta), eta) *
diff(f(eta), eta$2)^2-f(eta)*diff(f(eta), eta$2)*diff(f(eta), eta$3)) = 0:

bcs2 := theta(0) = 1, (D(theta))(0) = -2.876:

Sol:= proc(k1)
     if not k1::realcons then return 'procname'(args) end if;          
     dsolve(
          eval({eq||(1..2), bcs||(1..2)}, k_1= k1),
          numeric, method= bvp[middefer], maxmesh= 2^13, abserr= 1e-4
     )
end proc:

plots:-animate(
     plots:-odeplot,
     [Sol(k1), [[eta, f(eta)], [eta, theta(eta)]], eta= 0..2],
     k1= 1.5..2.5
);

Yes, you can know the order of the error. The order of the error is an inherent property of the method; it does not depend on whether the exact solution is known.

Using solve instead of fsolve will give both solutions in this case, although I can't say that this is generally true. Certainly fsolve always gives at most one solution to a transcendental equation.

n:= LinearAlgebra:-RowDimension(A):
P:= (LinearAlgebra:-IdentityMatrix(n)-A)^(-1).A;

The syntax requires

dsolve({bs} union sys1);

Note that you used {} on sys1 and not on bs. You need to take that into account in your call to dsolve.

But there is a deeper problem. The system cannot be solved for the last constant. You can impose the first five boundary conditions like this:

dsolve({bs[1..5]} union sys1);

This will give you a system with one constant. For now, I leave it to you or someone else to address why it cannot be solved for this constant using your conditions.

This will be easiest to do in the case where the curves in the original are all one color and you want to convert them to all one color. Let's suppose that you want to convert them all to black. Then do

macro(C= ColorTools):
subs(
     indets(P, specfunc(anything, COLOUR))[] =
     COLOUR(RGB, C:-RGB24ToRGB(C:-NameToRGB24("black"))[]),
     P
);

Note carefully that COLOUR is spelled with a U and that ColorTools is spelled without a u (a result of a Canadian identity crisis :-) ).

If you are dealing with a case of multiple colors, something can still be done---let me know.

Use

return fff, ggg;

or

return [fff, ggg];

Use the former if you are prepared to accept multiple outputs. Use the latter if you want to treat the multiple outputs as a single entity.

@jcrose 

First, convert the decimals in your Matrix to exact fractions with

polyGLS:= convert(polyGLS, rational):

Then

RRF:= LinearAlgebra:-ReducedRowEchelonForm(polyGLS);

This command completes in about 4 minutes on my computer, and uses only about 300M of memory. I get the bottom three rows of the matrix going to 0. This can be viewed with

RRF[5..7, ..];

I am using Maple 18. If you are using earlier Maple and cannot duplicate my results, please let me know.

You need to use one more level of unevaluation quotes:

Z2:= ' 'sin(-a*x+b)' ';
subs(sin= cos, Z2);

Another option is to use inert functions. The inert form of a function is obtained by prepending % to the name. For example,

Z2:= %sin(-a*x+b);
Z4:= subs(%sin= %cos, Z2);

When the expression is the way that you want it, use value to change the inert functions to their active forms:

value(Z4);

Change x < y to is(x < y). Or is that still too awkward?

I cannot follow your English, your notation, or your formatting close enough to check your work, your truth tables. However you can easily check them yourself using Maple's Logic package. Example:

with(Logic):
`&->`:= `&implies`:
`&<->`:= `&iff`:
`&^`:= `&and`:
`&v`:= `&or`:

MP:= (A,B)-> B &-> A:
Tautology(MP(p,q) &<-> MP(&not q, &not p));

                                                           true

The corrected version of your procedure returns eval(expr):

f:=proc()
local z,x,expr;
     expr:=3*z;
     z:=solve(x-1=0,x);
     eval(expr)
end proc:

You violated precisely the rule expressed in the paragraph which you thought wasn't in plain English: expr was only evaluated to a single level. You might find this explained more clearly at ?eval . Let me know.

 

You need to follow the anonymous procedure definition with a ( ) to invoke it. Otherwise, the whole procedure definition becomes the return value of the if statement (if that branch is taken). (The body of the if statement is indeed being called in your example.) Example:

f:= proc()
local x:= 9;
     if x < 10 then
          proc()
          local z:= 20;
               x:= z
          end proc
          ()    
     end if;
     x
end proc:

f();                                                    
                                            20

I use this technique fairly often in my code. It is especially useful when you want to execute the inner procedure in the evalhf environment. The () can go right next to the end proc if you want; my style is to place in on its own line to clearly distinguish it from a procedure-as-return-value.

Maple calls them keyword parameters. They are heavily used in library code. See ?parameter_classes . Example:

Foo:= proc({Arg_1::integer:= NULL, Arg_2::float:= NULL})
     Arg_1+Arg_2
end proc:
Foo(Arg_1 = 3, Arg_2 = 0.5);
                                                          
3.5

I don't really the understand the question as posed by your prof, but I do understand what you were trying to do with your code. Here's how to actually do it. Only one command is required.

plots:-contourplot(x^2-2*y^2, x= -5..5, y= -5..5, contours= [seq(C, C= -5..5)]);

First 314 315 316 317 318 319 320 Last Page 316 of 395