Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Anything that you can do to narrow the search space will help fsolve (this does not apply to solve). In this case, a little bit of plotting should convince you that there is a negative solution. Simply providing that information to fsolve is enough:

params:= {
    k = 1.3806e-23,
    T = 300,
    h__bar = 1.05456e-34,
    L__z = 6e-9,
    m__hhw = 3.862216e-31,
    E__hh0 = 3.012136e-21,
    E__hh1 = 1.185628e-20
}:
p:= k*T*m__hhw*(ln(1+exp(E__fv-E__hh0)/(k*T))+
  ln(1+exp(E__fv-E__hh1)/(k*T)))/(Pi*h__bar^2*L__z) = 0.3e25;

fsolve(eval(p, params),
E__fv= -infinity..0);
                          -48.46001884
 

@mehdi jafari There are two completely separate issues involved in the cases that you show where simplify(...) assuming real doesn't return what you think it should. In the first case, you use

simplify(..., sqrt) assuming real

In this case it's the sqrt that's preventing the simplication that you want, and this would still be true even if the the input were a single algebraic expression rather than a Matrix. Instead, change your command to

simplify(...) assuming real

I don't consider the above to be a bug, or even a weakness.

In your second case, you use

simplify(S_NEW(2,2)) assuming real

where S_NEW is a Matrix. Here, you are using the so-called programmer indexing, i.e., you put the indices (2,2) in parentheses rather than square brackets, [2,2]. This case does seem to be a weakness of assuming (it's not a weakness of simplify); however, I recommend that you always index with square brackets unless you specifically know that programmer indexing is required for your operation (such a situation is rare). So, if you change the above to

simplify(S_NEW[2,2]) assuming real

then it'll work.

The command that you're thinking of is IterativeMaps:-Bifurcation. See its help page. However, I am confused by your usage of an equation rather than an expression.

When a worksheet (or document) is viewed as a slideshow (via menu View => Slideshow), its sections become the slides. This means that you need to make each section small enough that it fits on one screen. So, if you need to present a slideshow, it'd be wise to first perfect your edit of the flat (un-sectioned) worksheet, then divide it into sections. Also, the presentation is fixed slides rather than executable code. Generally, when I give a presentation, I prefer to execute key parts of the code directly for my audience. That helps maintain their attention.

This seems to me to be a very weak feature of Maple.

In the following line, you've misspelled indkomst as indomst:

elif 44000 < 0.92*indkomst and indomst <= 44000+fradrag then

Your worksheet begins with the line

restart; ... several with commands ....

But, the restart command should always stand alone in its own execution group. Failure to do so can cause intermittent and irreproducible errors related to the other commands on the same line not being executed.

I cannot test this solution for you because the error is, of course, irreproducible for me.

And, personally, I never rely on the with command to find procedures for me. This is not because I think that there's some bug in with; rather it's because I think that it leads to less-readable code.

Change the line

A:= seq(...)

to

A:= < seq(...) >

This will make a Vector rather than a sequence. The Export command (like almost all commands) cannot except a sequence as an argument.

Here's an example. Here's two 2x3 matrices:

A:= <1, 2, 3; 4, 5, 6>; 
B:= <a, b, c; d, e, f>;

This command will take the 2nd row of each and combine them into a new 2x3 matrix:

C1:= <A[2,..], B[2,..]>;

This command will take the 2nd row of each and adjoin them side-by-side:

C2:= <A[2,..] | B[2,..]>;

For the first of these combinations it's of course required that the number of columns be the same in A and B. For the second, that's not required.

Regarding your first question---selecting the 3rd element from each sublist of a list of lists L1---here are three more ways to do it. I find these more intuitive, although there's hardly any difference in efficiency compared to the other Answers.

L1[..,3];
index~(L1, 3);
op~(3, L1);

Experienced Maple users may be surprised that the first of these--which uses Matrix-style indexing--works even if the sublists have different lengths, that is, if L1 cannot be interpreted as a Matrix.

Regarding your third question---sorting a list of lists L3 based on the 3rd elements---here is a better way, both more intuitive and (slightly) more efficient:

sort(L3, 'key'= (L-> L[3]));

For a very long list, a key sort is more efficient than a sort that uses a comparison function because the key of each entry only needs to be extracted once.

Inside procedure U, you've used the names `U__&eta` and `U__&theta`. But in procedure plug, you've used U__eta and U__theta. These are completely different names to Maple even though they appear the same when prettyprinted.

Have you checked the help page ?index,threadsafe to check whether your code is threadsafe? What you described is common if you try to use procedures that aren't threadsafe with Threads.

Usually it is not necessary to quit Maple entirely, despite what the "lost kernel connection" message on your screen might say. Usually you just need to kill the errant kernel process and close and re-open its assocciated worksheet. If you have multiple worksheets open, doing it this way is much less grief.

By hand (actually, in my head), I isolate the relevant derivative: 

ode:= diff(x(y),y) = a*y^(-6*b-1) - 4*x(y)/y;

Then use dsolve:

dsolve(ode);

    

How about the simple and obvious 

Linear:= (f::polynom, V::{list,set}(name):= indets(f, And(name, Not(constant))->
   evalb(degree(f, V) <= 1)
:

The problem is that much time is wasted on futile symbolic computation of the integrals. Put the option numeric in your integrals. Get rid of evalf. Example:

Digits:= 15:
int(79.977249/(z+7.943)^2/(z^0.1408592322+7.943), z= 1..infinity, numeric);
                       
0.953406537701741

That's returned in 0.016 seconds.

Acer's suggestion of evalf(Int(...)) is essentially equivalent to the above. We were just writing our Answers at the same time.
 

So, without showing any apparent reason for doing so, you use this crazy value 50 billion as one of your upper limits? Reduce that value to a reasonable size and the command will work quickly.

What do you expect to happen if there are a billion roots? that they'd be printed on your screen? Unless you have some unusually massive computer, they wouldn't even fit in your RAM.

C'mon, are you seriously trying to claim that you didn't already know, or at least strongly suspect, that this 50 billion was the source of your error? And if you already suspected that, why didn't you try changing it?

First 140 141 142 143 144 145 146 Last Page 142 of 395