tomleslie

13821 Reputation

20 Badges

14 years, 290 days

MaplePrimes Activity


These are answers submitted by tomleslie

  1. Suggest you read the DEplot help page in order to get the correct syntax!!
  2. You are using equi rather than equ1 in the DEPlot command - this is a simple typo
  3. There is actually a singularity at x=0 for all t, so it is never going to work with an initial value of x(0)=0

Having said all of the above, the following "works" for me, although each of the start values heads for the t-axis, ie x(t)=0, at which point the plot "fails" because of the singulariy there, which is the "correct" thing to do!

restart:
with(DETools):
equ1 := x(t)^4-5*x(t):
equ2 := 1/x(t)+x(t)^2+3:
DEplot( diff(x(t), t)=equ1-equ2, x(t), t=0..1, {x(0)=-2, x(0)=-1, x(0)=0, x(0)=1, x(0)=2});

 

 

  1. Change the program generating the data so that it produces an output file in a format which is understood by maple's ImportMatrix() command
  2. Read it as text, and do a bit of string manipulation. For the example you presented, the following worked for me

restart:
entry:= NULL:
with(StringTools):
while true do
      line:= readline("./testMat.txt");
      if   line <>0
      then entry:= entry, map(parse, remove(type, Split(SubstituteAll(line, "|", "")),""));
      else break:
      fi:      
od;
myMat:=Matrix([entry]);

You may have to edit the readline argument depending on the location of the data file with respect to the current working directory

@maple fan 

I could be wrong, but your

  1. original post contains 3 equations in 6 unknowns - as far as Maple is concerned f1, f2, f3, x, y, z all have equal status as variables. No way to solve this for all 6 variables
  2. however your second post suggests that what you actually want to know is the value of the FUNCTIONS f1, f2, and f3 for given values of x, y, z. If this is the case then you need to ensure that Maple knows that f1, f2, f3, are to be treated as FUNCTIONS of x, y, z

Easiest way to do this is to use the notation f1:=(x, y,z)->RHS of your original equation. You can then get any value you want simply by typing, for example,  f1(0.0, 0.0, 0.0) at the maple prompt.

Because all the coefficents in your expressions are integers, Maple will not resolve solutions to a floatiing point number - you may get a ratio of integers. In order to ensure that you get floating point solutions the easiest thing to do is pass floating point arguments, not integers, that is f1(0.0, 0.0, 0.0) rather than f1(0,0,0)

I have made this changes in the worksheet below so you can experiment

If this isn't what you wanted to achieve then please ignore this post

 

eqns.mw

restart:
period:=12:
myplot2:= proc( x )
                local y:
                global period:
              #
              # Scale passed argument to base period
              #
                y:= x-period*trunc(x/period):
              #
              # return function value
              #
                piecewise( 0<=y and y<2, 4,
                           2<=y and y<period,0
                         ):
          end proc:
plot( myplot2, 1..100);

First 205 206 207 Page 207 of 207