tomleslie

5033 Reputation

15 Badges

9 years, 219 days

MaplePrimes Activity


These are answers submitted by tomleslie

In maple 2015.1, the script

restart;
with(Units[Standard]):
1.0*Unit(volt)/(2000.0*Unit(ampere));

ought to provide output with units of ohms (indicated by a capital omega)

I do not know any way to force the display to use "engineering" notation

 

Adding a couple of simple commands to the end of your original worksheet, I come up with the following

_C3=0,
_C2 is arbitrary
_C1=-2*_C2*s+2/s

see attached.

LGMsol.mw

As in

#
# Generate the expression and save it to a txt file
# because the file extension is .txt, then this file
# will be human-readable
#
   f:=x^2;
   f1:=diff(f,x);
   save f1, "J:/Users/TomLeslie/savetest.txt";
#
# Wipe the previous info, check f1 to make sure it
# has been cleared, then read it from the file and
# check again
#
   restart;
   f1;
   read "J:/Users/TomLeslie/savetest.txt":
   f1;

Obviously you wiill have to change the pathName/filename in the above commands to something appropriate for your machine

Assuming that you want to import data from Excel ranges to and assign these to "sensible" Maple names, consider the attached (contains a lot of step by step comments)

XLimport.mw

Well actually , as far as Maple is concerned, you hav 32 "variables". You seem to thing that Maple can telll the difference between "variablles" and "paramters" with no guidance. Trust me, this is not going to happen!!

You have 32 unknowns and 6 equations, which essentially means that you can pick any 6 unknowms and solve for these in terms of the other 26. The attached woksheet shows one possibility

elimPoob.mw

I'm not exactly sure what you want because your question is too general.

However tha attached file computes

  1. the "exact" solution,
  2. the "approximate" solution ( using a method with which I am unfamilar)
  3. graphs the difference,
  4.  computes the differnce between the exact an the approximate solution at a few points

I'm not sure if this covers your requirements or not - maybe if you can clarify in some way???

VIMdebug1.mw

File extension should be .mpl

If I run

restart;
read "J:\\Users\\TomLeslie\\testproc.mpl"
create({{a, b}, {b, c}, {b, d}});

where testproc.mpl is

create := proc (data::set)
                        local G;
                        with(GraphTheory);
                        G := GraphTheory:-Graph(data);
                        printf("My Graph is %a", G);
                        save G, "J:\\Users\\TomLeslie\\graph.txt":
              end proc:

Then the file graph.txt appears where I would expect it to.

Before trying the above you will have to change the path names back to those relevant for your machine

 

  1. Put a colon/semicolon after restart - otherwise maple thinks that you are making multiple assignments (which you aren't
  2. Be careful with brackets. (), [], {} all mean different things to Maple: [] implies an indexed name of some sort, and {} implies a set. () is used for simple grouping of terms within an expression. You have used [] brackets within the expression you wish to solve - syntactically incorrect and confuses Maple

See the attached, which at least executes - not sure you'll like the answer though!

equB.mw

Kitonum's solution will do the solve() operation for each value of b. This can be avoided with

fb:=unapply( solve( [x+b*y=0, b*x-y=10], {x, y}),b);

to produce a function which can be evaluated for any value of b with

fb(10); fb(11); #etc

or for a seqauence of values

seq( [b=j, fb(j)[]], j=10..20);

 

If you use 2-D math input in Maple then pages are not "mangled" they are "correct"

However I only ever use 1-D math input - I have never worked out what the advantage of 2D math input is supposed to be, and whenever I try it, something breaks, so I avoid it like the plague.

Generally I only ever use the local help on my machine rather than the on-line version. However even on local help pages I have noticed (in Maple 18 and esp Maple 2015) that the "default" presentation format for examples is 2-D Math input: so before using, I change these by unchecking  the View -> Display Examples with 2D Math on the help page. This gives me 1-D math input and copy/paste actions then always work

There appears to be no way convert the on-line Maple help from 2-D math input to 1-D input :-(

A bit like Preben, I had a great deal of difficulty trying to figure out, from your code, exactly what you are trying to do.

I wasn't even certain that your starting equation was of the Lane=Emden type, so I tarted from started from a different angle: I chose the canonical Lane-Emden equation from the Wikipedia page, and wrote the code to solve it. This is attached below

LE.mw

If you compare the graphical output with that on the Wikipedia page, you will note that it is identical. I did also verify that (for the canonical problem) Maple can produce analytical solutions for n=0 and 1, which agree with those on the wikipedia page. However Maple was unable to produce the analytical solution for n=5, which wikipedia says is possible - although - I didn't try very hard with this. I suspect that if I coded the approach for n=5 as shown on the wikipedia page then I would be successful

You may have write privileges - but that doesn't mean that Maple does!

Try starting Maple by right-clicking desktop icon and selecting run as administrator, cos

restart;
fd := FileTools[Text][Open]("C:\\foo.txt", create=true,overwrite=true);

works for me

The computation you require is relatively trivial. The optimum method for doing it depends very much on how you subsequently plan to use the data.

For the example you quote f(x,y,z)=x+yz. Well, you could use a 3-D array to store all the values, with

f:=(x, y, z)-> x + y * z;

ans:=Array( -10..10, -10..10, -10..10,

            [ seq
              ( [ seq
                  ( [ seq
                      ( f(x, y, z), x=-10..10)
                    ],
                    y=-10..10
                  )
                ],performing "SENSITIVITY ANALYSIS"
                z=-10..10
              )
            ]
          );

and then access values with (eg) f[2,3,4].

On the other hand you could just define the function

f:=(x, y, z)-> x + y * z;

and compute any values you happen to want on-the-fly.

The optimal method for performing "sensitivity analysis" really depends on exactly  how you are going to use the data, because, generating the data is trivial

 

To quote the manual entry for dsolve (with my emphasis)

Integrals appearing in answers returned by dsolve are expressed using the inert Int and Intat (not int or intat). These integrals appear when int is not able to calculate them or when it appears to be convenient not to evaluate them during the solving process. You can request the evaluation of these integrals using the value command.

And for some values of m,k in your loops, unevaluated integral were being returned - which broke the subsequent solve() command.

Somehat surprisingly, it seems that the relevant integrals can always be evaluated, and making the change below

soln[m, k] := rhs(dsolve(ode[m, k], f[m, k](r)));

becomes

soln[m, k] := value(rhs(dsolve(ode[m, k], f[m, k](r))));

means that your loop now completes, and the result[] table is populated.

See the attached

DEProb.mw

If your matrix only ever contains (real) numeric values (ie no symbols, complex nos, etc), the you can specifyt the datatype as an option to the Matrix() constructor

M:=Matrix(3,3, datatype=realcons);

Then

M[1,1]:=1, or M[1,1]:=1.0 will work, but M[1,1]:=x, or M[1,1]=1+2*I will throw an error.

On the other hand, if you wnat to place assumptions on pre-existing symbolic matrix entries, then

MM:=Matrix(3,3, symbol=a);
map(assume, MM, real):
MM;

works for me

First 104 105 106 107 108 109 110 Page 106 of 113