sfdesignguru

120 Reputation

4 Badges

14 years, 88 days

MaplePrimes Activity


These are replies submitted by sfdesignguru

My question is

Why can't I use the "I" directly for solve function?
Seems the solve function does treat the "I" as a symbol.

 

 

My question is

Why can't I use the "I" directly for solve function?
Seems the solve function does treat the "I" as a symbol.

 

 

Thanks all for your help!

That is what I am looking for :-)

Thanks all for your help!

That is what I am looking for :-)

Hi, Thanks a lot for your help!!! Finally I was able to finish a small project on behavioral modeling of nonlinear system using Maple :-) It would take forever without your help...! You should open Maple classes or write a book :-) Thanks again! Happy Thanksgiving!!!
Hi, Thanks a lot for your help!!! Finally I was able to finish a small project on behavioral modeling of nonlinear system using Maple :-) It would take forever without your help...! You should open Maple classes or write a book :-) Thanks again! Happy Thanksgiving!!!
===> Question 1: We have found number of occurance through the following: a:=[1, 1, 1, 3, 4, 7, 3.2, -1, -1, 5, 1, -1]: numboccur(a,{1,-1}); Without using for or other loop statements, Can we print its index easily? I expect to print the result as 1, 2, 3, 8, 9, 11, 12 As seen, index in the array is printed in order when number is 1 or -1. Can we also print numbers in order when number is 1 or -1? I expect to print the result as 1, 1, 1, -1, -1, 1, -1 As seen, its actual number is printed in order when number is 1 or -1. ===> Question 2: I used the "Array" but not "array". Here is an example code. restart: a:=Array(1..12): for i to 12 do a[i]:=i: end do: print(a); nops(a); I expect contents of a is 1,2,3,4,5,6,7,8,9,10,11,12 But the code doesn't print contents of a properly. I see the following message: [1.12 1-D Array Data Type: anything Storage: rectangular Order: Fortran_order] Can you explan why the "print(a)" doesn't print contents of a? I noticed when I change the Array size to be 5. I was able to print the contents properly. Does the Array have a limitation? Thanks!
===> Question 1: We have found number of occurance through the following: a:=[1, 1, 1, 3, 4, 7, 3.2, -1, -1, 5, 1, -1]: numboccur(a,{1,-1}); Without using for or other loop statements, Can we print its index easily? I expect to print the result as 1, 2, 3, 8, 9, 11, 12 As seen, index in the array is printed in order when number is 1 or -1. Can we also print numbers in order when number is 1 or -1? I expect to print the result as 1, 1, 1, -1, -1, 1, -1 As seen, its actual number is printed in order when number is 1 or -1. ===> Question 2: I used the "Array" but not "array". Here is an example code. restart: a:=Array(1..12): for i to 12 do a[i]:=i: end do: print(a); nops(a); I expect contents of a is 1,2,3,4,5,6,7,8,9,10,11,12 But the code doesn't print contents of a properly. I see the following message: [1.12 1-D Array Data Type: anything Storage: rectangular Order: Fortran_order] Can you explan why the "print(a)" doesn't print contents of a? I noticed when I change the Array size to be 5. I was able to print the contents properly. Does the Array have a limitation? Thanks!
I made a tiny mistake. That is why proper label 
for X-axis didn't show up. :-) I now can see proper labels.

======>
Question 1:
As described the above, you assmed a=[-5,-3,1,2,4].
Then without removing the op(-a) as seen in my code, 
how could I modify your code to plot -5,-3,1,2,4 only rather than plotting its symmetry values 5,3,-1,-2,-4 ?


======> 
Question 2:
when we draw "positive" side plot using "pos", its first point is close to Y-axis. 
How can I make proper distance from Y-axis from the first point? 
Using "view" option ???

=====>
Question 3:
How can I count paticular numbers?
ie) Let's assume we have the following data
a:=[1, 1, 1, 3, 4, 7, 3.2, -1, -1, 5 1, -1]:

How can I count how many both 1 and -1 has in the array?
I expect to have 7 counts.

=====>
Question 4:
I have a data such as:
a:=[1,2,3,4,1,5,2,2]:
As seen in the array, the number "1" has twice and "2" has three times. What I want is that
(1) Find true or false from the array data.
If any number is duplicated in the array, 
it is "true" otherwise "false"

(2) Then find what number is duplicated.
From the above example, 
duplicated numbers are "1" and "2".


=====>
Question 5:
I made the following simple expression.
restart:
X:=array(1..12):
for i to 12 do
X[i]:=i:
end do:
print(X);
nops(X);

Its result came out:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
size:=1

How can I print the array size to be 12?
Somehow using the "nops" doesn't give me a correct size.

Let's assume the X is Table and not an array.
In the case, how can I display number of contents in the table?
i.e)
for i to 12 do
X[i]:=i:
end do:
print(X);
nops(X);

Its result:
TABLE([1 = 1, 2 = 2, 3 = 3, 5 = 5, 4 = 4, 7 = 7, 6 = 6, 10 = 10, 11 = 11, 8 = 8, 9 = 9, 12 = 12])
size:=1

** Still give me 1 for table size. I expect 12.

======>
Question 6:
I sorted the "a" array under assumptions and its result came out.
Used code:
a:=[w1+w2-w3,
    -w1+2*w2,
    2*w1-w2-2*w3,
    -w1+w2-w3,
    -w1+w2+w3]:
 b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:
 sort(convert(a,list),is @\<\) assuming b; 

Sort result becomes:
2*w1-w2-2*w3, -w1+w2-w3, w1+w2-w3, -w1+2*w2, -w1+w2+w3

If we plot original values (without symmetry values),
points in X-axis perfectly match with the sort result !! :-)

Let's assume we draw the plot in positive side only using your "pos" procedure.
Order of points in X-axis plot now becomes:
w1+w2-w3, w1-w2+w3, -w1+2*w2, -w1+w2+w3, -2*w1+w2+2*w3

As seen, its order is now different from the result by 
previous "sort" function and the negative symbol becomes positive in positive plot.

How can I modify the previous "sort" command to match with the order of positive points and symbols in X-axis plot?

Thanks!
I made a tiny mistake. That is why proper label 
for X-axis didn't show up. :-) I now can see proper labels.

======>
Question 1:
As described the above, you assmed a=[-5,-3,1,2,4].
Then without removing the op(-a) as seen in my code, 
how could I modify your code to plot -5,-3,1,2,4 only rather than plotting its symmetry values 5,3,-1,-2,-4 ?


======> 
Question 2:
when we draw "positive" side plot using "pos", its first point is close to Y-axis. 
How can I make proper distance from Y-axis from the first point? 
Using "view" option ???

=====>
Question 3:
How can I count paticular numbers?
ie) Let's assume we have the following data
a:=[1, 1, 1, 3, 4, 7, 3.2, -1, -1, 5 1, -1]:

How can I count how many both 1 and -1 has in the array?
I expect to have 7 counts.

=====>
Question 4:
I have a data such as:
a:=[1,2,3,4,1,5,2,2]:
As seen in the array, the number "1" has twice and "2" has three times. What I want is that
(1) Find true or false from the array data.
If any number is duplicated in the array, 
it is "true" otherwise "false"

(2) Then find what number is duplicated.
From the above example, 
duplicated numbers are "1" and "2".


=====>
Question 5:
I made the following simple expression.
restart:
X:=array(1..12):
for i to 12 do
X[i]:=i:
end do:
print(X);
nops(X);

Its result came out:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
size:=1

How can I print the array size to be 12?
Somehow using the "nops" doesn't give me a correct size.

Let's assume the X is Table and not an array.
In the case, how can I display number of contents in the table?
i.e)
for i to 12 do
X[i]:=i:
end do:
print(X);
nops(X);

Its result:
TABLE([1 = 1, 2 = 2, 3 = 3, 5 = 5, 4 = 4, 7 = 7, 6 = 6, 10 = 10, 11 = 11, 8 = 8, 9 = 9, 12 = 12])
size:=1

** Still give me 1 for table size. I expect 12.

======>
Question 6:
I sorted the "a" array under assumptions and its result came out.
Used code:
a:=[w1+w2-w3,
    -w1+2*w2,
    2*w1-w2-2*w3,
    -w1+w2-w3,
    -w1+w2+w3]:
 b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:
 sort(convert(a,list),is @\<\) assuming b; 

Sort result becomes:
2*w1-w2-2*w3, -w1+w2-w3, w1+w2-w3, -w1+2*w2, -w1+w2+w3

If we plot original values (without symmetry values),
points in X-axis perfectly match with the sort result !! :-)

Let's assume we draw the plot in positive side only using your "pos" procedure.
Order of points in X-axis plot now becomes:
w1+w2-w3, w1-w2+w3, -w1+2*w2, -w1+w2+w3, -2*w1+w2+2*w3

As seen, its order is now different from the result by 
previous "sort" function and the negative symbol becomes positive in positive plot.

How can I modify the previous "sort" command to match with the order of positive points and symbols in X-axis plot?

Thanks!
Thanks for quick help!
I was thinking "if" statement to extract index# of the array from sorted data.

Another challenge to plot Dirac function!
Let's use our "a" array:
a[1]:=w1+w2-w3:
a[2]:=-w1+2*w2:
a[3]:=2*w1-w2-2*w3:
a[4]:=-w1+w2-w3:
a[5]:=-w1+w2+w3:

Using assumptions, we now know what the max, min, and order is.
Let me define w1, w2, and w3 with a real number to plot Dirac function.
w1:=50
w2:=60
w3:=65

As seen, the number well falls into our assumptions.
Let me define Dirac function using the array.
S := 20/7*k*Dirac(w - a[1])+2*k*Dirac(w - a[2])+
      10*k*Dirac(w - a[3])+1*k*Dirac(w - a[4])+8/3*k*Dirac(w - a[5])

Let's define the symbol k for drawing plot
k:=1  # I want to display k symbol using tickmarks in plot

Expected plot may be like this because we know order by sort:

 Amplitude
     ^
     |
     |       |       |        |        |         |
     |       |       |        |        |         |
-----|-------+-------+--------+--------+---------+------> w [Rad/sec]
       2w1-w2-2w3 -w1+w2-w3 w1+w2-w3 -w1+2w2 -w1+w2+w3

Its amplitude in X-axis could be different accordingly. but should have label with "k".
ie) If amplitude is 5/3*k, plot display the 5k/3.

I now face a challenge how I define the "tickmarks" and "view" automatically by reading the information of array and amplitude.
The "tickmarks" and "view" in plots option should be changed accordingly based on real numbers of w1, w2, and w3..and amplitudes.

The "view" range for X and Y-axis could be found min and max function using amplitude and real w numbers.
The "tickmarks" could be also defined automatically using real numbers and its w function.
i.e) With the w1, w2, and w3 real numbers, 
w1+w2-w3 can be replaced with 50+60-65 = 45
So "tickmarks" for 45 should represent w1+w2-w3

To make a more universal program, 
can I generate the "plots" function with auto generated "tickmarks" and "view"?
so that..whenever I change w1, w2, and w3 numbers and amplitudes, Plot should also be changed accordingly
rather than changing the "tickmarks" and "views" in "plots" manually. 

Seems this becomes another challenge for me :-)
Thanks!

FYI,
The following is the previous "plots" example:
plots[display](F(S),color=blue,
  tickmarks=[[-4="-w3",-3="-w2",-1="-w1",1="w1",3="w2",4="w3"],
    [0=0,1.5=K2,2=K1,3=K3]],
  labels=[`w [Rad/sec]`,Amplitude],view=[-6..6,0..4]);

Thanks for quick help!
I was thinking "if" statement to extract index# of the array from sorted data.

Another challenge to plot Dirac function!
Let's use our "a" array:
a[1]:=w1+w2-w3:
a[2]:=-w1+2*w2:
a[3]:=2*w1-w2-2*w3:
a[4]:=-w1+w2-w3:
a[5]:=-w1+w2+w3:

Using assumptions, we now know what the max, min, and order is.
Let me define w1, w2, and w3 with a real number to plot Dirac function.
w1:=50
w2:=60
w3:=65

As seen, the number well falls into our assumptions.
Let me define Dirac function using the array.
S := 20/7*k*Dirac(w - a[1])+2*k*Dirac(w - a[2])+
      10*k*Dirac(w - a[3])+1*k*Dirac(w - a[4])+8/3*k*Dirac(w - a[5])

Let's define the symbol k for drawing plot
k:=1  # I want to display k symbol using tickmarks in plot

Expected plot may be like this because we know order by sort:

 Amplitude
     ^
     |
     |       |       |        |        |         |
     |       |       |        |        |         |
-----|-------+-------+--------+--------+---------+------> w [Rad/sec]
       2w1-w2-2w3 -w1+w2-w3 w1+w2-w3 -w1+2w2 -w1+w2+w3

Its amplitude in X-axis could be different accordingly. but should have label with "k".
ie) If amplitude is 5/3*k, plot display the 5k/3.

I now face a challenge how I define the "tickmarks" and "view" automatically by reading the information of array and amplitude.
The "tickmarks" and "view" in plots option should be changed accordingly based on real numbers of w1, w2, and w3..and amplitudes.

The "view" range for X and Y-axis could be found min and max function using amplitude and real w numbers.
The "tickmarks" could be also defined automatically using real numbers and its w function.
i.e) With the w1, w2, and w3 real numbers, 
w1+w2-w3 can be replaced with 50+60-65 = 45
So "tickmarks" for 45 should represent w1+w2-w3

To make a more universal program, 
can I generate the "plots" function with auto generated "tickmarks" and "view"?
so that..whenever I change w1, w2, and w3 numbers and amplitudes, Plot should also be changed accordingly
rather than changing the "tickmarks" and "views" in "plots" manually. 

Seems this becomes another challenge for me :-)
Thanks!

FYI,
The following is the previous "plots" example:
plots[display](F(S),color=blue,
  tickmarks=[[-4="-w3",-3="-w2",-1="-w1",1="w1",3="w2",4="w3"],
    [0=0,1.5=K2,2=K1,3=K3]],
  labels=[`w [Rad/sec]`,Amplitude],view=[-6..6,0..4]);

We have found how we could sort unknown values based on assumptions.
Now how can we find index from sorted data?

As shown in an example before, we have an array if "a":
a[1]:=w1+w2-w3:
a[2]:=-w1+2*w2:
a[3]:=2*w1-w2-2*w3:
a[4]:=-w1+w2-w3:
a[5]:=-w1+w2+w3:
b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:

Sort results came out using "sort" function before as following:
[2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,
        -w1 + w2 + w3]

How can I display index# of sorted data?
Its result should be something like that.
[3, 4, 1, 2, 5]
As seen, index# from the array should be displayed according to sort.

You also mentioned before, to draw plot, data should be real numbers?
We have sorted numbers and assumptions,  can I draw a plot with the data?
or For plotting, should I plug in a real number for w1, w2, and w3?

i.e) plug-in unknown values of an array "a".
S := Dirac(w - a[1]) +  Dirac(w - a[2]) + Dirac(w - a[3]) + Dirac(w - a[4]) +  Dirac(w - a[5])
We know where the array of "a" is located based on sorted data and assumptions.
Possible to plot the "S" function? or should values have to be real numbers?

Thanks,
We have found how we could sort unknown values based on assumptions.
Now how can we find index from sorted data?

As shown in an example before, we have an array if "a":
a[1]:=w1+w2-w3:
a[2]:=-w1+2*w2:
a[3]:=2*w1-w2-2*w3:
a[4]:=-w1+w2-w3:
a[5]:=-w1+w2+w3:
b:=w3>w2,w2>w1,w1>0,w2-w1>w3-w2:

Sort results came out using "sort" function before as following:
[2 w1 - w2 - 2 w3, -w1 + w2 - w3, w1 + w2 - w3, -w1 + 2 w2,
        -w1 + w2 + w3]

How can I display index# of sorted data?
Its result should be something like that.
[3, 4, 1, 2, 5]
As seen, index# from the array should be displayed according to sort.

You also mentioned before, to draw plot, data should be real numbers?
We have sorted numbers and assumptions,  can I draw a plot with the data?
or For plotting, should I plug in a real number for w1, w2, and w3?

i.e) plug-in unknown values of an array "a".
S := Dirac(w - a[1]) +  Dirac(w - a[2]) + Dirac(w - a[3]) + Dirac(w - a[4]) +  Dirac(w - a[5])
We know where the array of "a" is located based on sorted data and assumptions.
Possible to plot the "S" function? or should values have to be real numbers?

Thanks,
Wow~ The way Maple handles the symbols is just amazing!!! Really appreciated for dedicated replies!
1 2 3 Page 1 of 3