tomleslie

13876 Reputation

20 Badges

15 years, 170 days

MaplePrimes Activity


These are replies submitted by tomleslie

Maple 2015.2 on Win7 64-bit, your worksheet executes with no errors. I only the get the following warnngs

Warning, `GoodSols` is implicitly declared local to procedure `GetRidOfDumbSolutions2`
Warning, `s` is implicitly declared local to procedure `GetRidOfDumbSolutions2`
Warning, `a` is implicitly declared local to procedure `test`

All of these are understandable since you have commented out the 'local' statements in the relevant procedures. If I "uncomment" the two relevant 'local' statements then your worksheet executes with no warnings and no errors.

Genuinely puzzled as to the source of you problem :-(

It is perfectly possible that the basic int(f(x), x=a..b) command may be unable to produce a "closed-form" solution, but it is somehat more rare for the the numeric approach evalf( Int(f(x), x=a..b)) to fail - assuming a numeric solution is acceptable. I suggest you try this. Alternatively, post meaningful code using the big green up-arrow

The code you post is pointless, since it calls many undefined quantities - see the annotations below

p_old := 0;
g := 0; #index
E_tot_net_Point := 0;
for g to 2 do
     h := g+1;
     loopstart := SP_time[g]; # SP_time[g] is undefined - therefore so is loopstart
     loopend := SP_time[h];  # SP_time[g] is undefined - therefore so is loopend
     for tt from loopstart by 0.01 to loopend do # neither loopstart nor loopend is defined,
                                                                     # so loop cannot execute

          t := tt;
          P_tot_net_Fkt := t -> C_motore[g]*omega_motore[g] # neither C_motore nor omega_motore is defined
                                                                                            # so function P_tot_net_Fkt is undefined
          if      t≠SP_time[g] and t ≠ SP_time[h] # SP_time[g] and SP_time[g] are undefined
                                                                     # so if condition cannot be evaluated
          then P_tot_net_Point := P_tot_net_Fkt(t); # P_tot_net_Fkt(t) is undefined, therefore
                                                                          # P_tot_net_Point is undefined

                 P_tot_net_Point_next := P_tot_net_Fkt(t+0.001); # P_tot_net_Fkt() is undefined, therefore
                                                                                             # P_tot_net_Point_next is undefined
                 plt_P_tot_net_plt[t] := pointplot([t, P_tot_net_Point]); # P_tot_net_Point is undefined so
                                                                                                    # pointplot() cannot be executed
                 E_tot_net_Point := E_tot_net_Point+(P_tot_net_Point*0.01); # neither E_tot_net_Point nor
                                                                                                              # P_tot_net_Point is defined
                                                                                                              # so this statement cannot execute
                 plt_E_tot_net_plt[t] := pointplot([t, E_tot_net_Point]); # E_tot_net_Point is undefined, so
                                                                                                    # pointplot() cannot execute
                 p_old := P_tot_net_Point; # P_tot_net_Point is undefined, therefore so is p_old
                                                         # however since p_old is not used anywhere in this
                                                         # calculation, this probaby doesn't matter too much
          end if;
     end do:
end do:

Since you are using pointplot(), then you either have an n by 2 matrix, or two lists/vectors of equal length. You do not specify

If you have the n*2 matrix, then search the first column for the value you want (eg 3), and return the corresponding value in the second column

If you have two lists/vectors, then search the first list/vector for the index corresponding to the value you want (eg 3) and then return the corresponding value from the second list/vector

If you actually posted any code - then it would be trivial to do it for you.

  restart;
  kernelopts(version);
  test :=  proc(  )
              local a;
             a := 3
             end proc;
   test();

returns

  Maple 2015.2, X86 64 WINDOWS, Dec 20 2015, Build ID 1097895
  test := proc () local a; a := 3 end proc
  3

which is what I would expect.

NB Win7 64-bit, Maple 2015.2

@shani2775 

I have read the above several times and am unable to work out your point. If I remove a few spurious parentheses, just for clarity, then I have,

f(x)*(D(f))(x)/(diff(f(x), x)^2-f(x)*(D@@2)(f)(x))

which has a denominator

diff(f(x), x)^2-f(x)*(D@@2)(f)(x)

In other words it is a difference of two terms diff(f(x), x)^2 and f(x)*(D@@2)(f)(x).

If these two terms are equal. then the denominator will be zero, and you have a problem. Now I have no control over what you choose for f(x) - I can only tell you that there are many choices for f(x) which will make the denominator zero. Try solving the the differential equation

diff(f(x), x)^2-f(x)*(D@@2)(f)(x)=0

Any function f(x) which satisfies this ODE will guarantee a zero denominator for all values of x - so don't even think about anything which looks like a*exp(b*x), since this will proved a zero denominator for all values of x.

On the other hand, if I suppose that the f(x) is a simple polynomial such as a*x^2+b*x+c, then I can easily produce specific values of x which will make the denominator zero - won't be zero for all x, but will be zero for certain values of x

I cannot change the laws of mathematics!!!! If you choose f(x) such that diff(f(x), x)^2-f(x)*(D@@2)(f)(x)=0, for any/all values of x - then you have a problem which no-one can fix!!

Focus on OP's question

we have positive number from 1 to 1000. how many time we write number 3?

Allowing for translation issues, I interpret this to mean: if I have to sharpen my pencil, and write down all the numbers from 1 to 1000, how many times will my pencil trace out the character '3' - for which the answer is 300, as Christophe2222 has demonstrated. His answer can also be obtained via

ulim:=1000;
add
( add
  ( `if`(p=3, 1, 0),
     p in [ seq
             ( irem( n, 10, 'n'),
               j = 1..length(n)
             )
           ]
  ),
  n=1..ulim
);

which I thought might be faster because it avoids all the string/number conversions

  - but it isn't, by a long way :-(

Probably one of the reasons why I never use it - actually I've just realised that because I run 64-bit Win7 - the 'classic' interface isn't even available! I can only use 'command-line' or 'standard'

I use the Standard interface on 64bit Win7, but assuming that 'classic' gives the same functionality, try the menu entry

Tools->Options->Interface and make sure that the 'Large Toolbox Icons' is checked

I have just checked my original post in Maple2015 and it executes perfectly.

It does not use the Student[VectorCalculus]SpaceCurve() command, but the plots[spacecurve]() command - note capitalisation within the command 'spacecurve' for the distiction. I can only assume that the Student[VectorCalculus]SpaceCurve() accept rather fewer options than plots[spacecurve]().

Carl's code also (now) works and also uses the plots[spacecurve] rather than the Student[VectorCalculus]SpaceCurve() command

@shani2775 

So does my earlier post fulfill your requirement or not??

If not - why not??

with or without realDomain,

simplify(u/sqrt(u*(u-1)), symbolic);

will also work - although use of the 'symbolic' option is a little risky since (as the help page suggests), it

Specifies that formal symbolic manipulation of expressions is allowed without regard to the analytical issue of branches for multi-valued functions.

Use with care!!!

@Carl Love 

Extra comma after second spacecurve() command - the following works

plots:-display( [ plots:-spacecurve
                                  ( [2*cos(t), sin(t), t],
                                     t= -6*Pi..6*Pi,
                                     thickness= 3,
                                     style= line,
                                     numpoints= 200
                                  ),
                        plots:-spacecurve
                                 ( [-2*t, 1, Pi/2+t],
                                    t= -5..5,
                                    color= black,
                                    style= line
                                 )
                     ],
                     axes= frame
                  );

My ideas on appropriate plot formatting are probably different from yours

I can only suggest that you check the plot3d/options help page and experiment to get you what you want. For example

 plot3d( eval( [ Profit_AA, Profit_BB ], [params] ),
          P[A] = 0..P[B]-0.01,
          P[B] = 0..0.5,
          axes = normal,
          labelfont = [times, bold, 16],
          title = "Profit_AA and Profit_BB vs P[A] and P[B]",
          titlefont = [times, bold, 20],
          style = patchnogrid,
          shading = zhue
          );

will look substantially different - but is it better? worse? - only you can decide

Don't really understand what you are trying to achieve, but the the following is

  1. close
  2. easier to understand/modify
  3. much "shorter" than the original

#
# Values for N, m must be supplied for anything
# to be produced
#
# Note that N must be >= m to get any terms at
# all
#
   N:=7:
   m:=5:
   add( (D@@i)(f)(0)*x^i/factorial(i),
           i=m..N
        );

Pretty sure that Rouben has it correct: if I understand your request correctly, the attached covers both the options which you seem to want

probplot.mw

 

First 163 164 165 166 167 168 169 Last Page 165 of 207