Items tagged with line

Hello there. I have to solve a simple line integral (3*y-x)dL from A(2;1) to B(3;-1). A and B are points in the line described by function y=5-2x. I found a function LineInt. Using paramether Line I wrote LineInt(3*y-x, Line(<2, 1>, <3, -1>)), it doesn't work with error below:

Error, (in Line:-ModuleCopy) invalid input: invalid specification of line

It seems that the problem is with first argument, that is the equation under the integral sign. Or no... How to write it properly? Thanks.

Good evening all,

How can I plot a straightline with points 

LogAt = - 0.097,  -0.20, -0.22, -0.25, -0.30 ,-0.40, -0.45, -1.01 and

t = 0, 20, 40, 60, 80, 100, 120, 140

Where LogA[t] on y-axis and t on x-axis. 

I have try this before . 

plot([[0,-0.097], [20,-0.20], [40,-0.22], [60,-0.25], [80,-0.30], [100,-0.40],  [120,-0.45],  [140,-1.01]]);

With a somewhat complicated equation for a line, draw fails.

with(geometry):

point(P1,[47+(38+22/60)/60, -(122+(43+4/60)/60)]);
point(P2,coordinates(P1) +~ [cos(30*Pi/180),sin(30*Pi/180)]);
line(L1,[P1,P2]);
Equation(L1);
draw(L1); ## no line

point(P1,[0,0]);
point(P2,[7,9]);
line(L1,[P1,P2]);
draw(L1);  ## works

Tom Dean

hello,
I try to draw together point (0,0,12) and the line  x=4t, y=-2t, z=2t on one graph 3D. Somebody has some pointers? Thank you 
Agnieszka

A wealth of knowledge is on display in MaplePrimes as our contributors share their expertise and step up to answer others’ queries. This post picks out one such response and further elucidates the answers to the posted question. I hope these explanations appeal to those of our readers who might not be familiar with the techniques embedded in the original responses.

The Question: How to sketch a line in space?

vahid65 wanted to know how to sketch the line with equation (x-2)/3 = (y-1)/4 = (z-3)/3 in a three-dimensional space.

This question was answered using two different approaches that we will discuss.

The first approach, given by Preben Alsholm, suggested using these commands: solve, subs, and plots:-spacecurve.

Preben provided the following lines of code:

  1. {(x-2)/3 , (y-1)/4 , (z-3)/3} =~t;
  2. solve(%,{x,y,z});
  3. L:=subs(%,[x,y,z]);
  4. plots:-spacecurve(L,t=-5..5,thickness=3,color=red);

The first line sets the three expressions equal to t using the element wise operator =~.  This distributes the operation of equality over the elements of the set of expressions, forming a set of equations.

Result-1: {(x-2)/3=t, (y-1)/4=t, (z-3)/3=t}

The second line invokes the solve command. The solve command, solve(equations, variables), solves one or more equations or inequalities for their unknowns. So in this line, this command was used to solve each expression for its corresponding unknown.

Result-2: {(x= 2+3t, y=1+4t, z= 3+3t}

You may have noticed that the % symbol is used within the command. This symbol is referring to the equation label that was created chronologically last. 

The third line uses the subs command. The subs command, subs(x=a,expr), substitutes “a” for “x” in the expression expr. In this case, “a” is the reference to the equation label referenced by (%) and expr is the sequence of variables x,y,z. The square brackets around expr forms a list, and the replacement imposed by the subs command replaces each of the three names x, y, and z with their equivalents in the set of equations returned by the solve command.

Result-3: [2+3t,1+4t, 3+3t ]

Finally the last line uses the plots:-spacecurve function.  This function, spacecurve(sc,r,opts),  graphs a parametrically defined curve in three-dimensional Cartesian space. 

In this example the first parameter, sc, is replaced by L since L has the properties of a list. The parameter  r is an equation containing the parameter name and the parameter range; here it is the equation t=-5..5. Last but not least, the opts parameter (which is optional) gives the user the opportunity to specify the optional properties of the graph, properties such as thickness and color of the space curve. 

Result 4: 

 

Another contributer, Carl Love, suggested that these commands could be combined using the zip function, zip( f, u, v), which is an unusual application of it. The zip command applies elementwise to corresponding members of the two lists u and v, the binary function f, creating a new list r, whose members are f(uk,vk).

Carl provided the following code:

plots:-spacecurve(  zip(solve, [(x-2)/3 , (y-1)/4 , (z-3)/3] =~ t, [x,y,z]),  t= -5..5, thickness= 3, color= red, axes= normal);

 

In this case zip is applying solve to u, a list of equations, and v, a list of variables. The equations in u are those in Result-1. The zip function returns the solution of each equation for the indicated variable, that is, the new list r is the list in Result-3. This list is the first argument of plots:-spacecurve. Finally, the parameter range and opts are up to the user’s preferences.

A second approach was suggested by Kitonum. The difference between this approach and the first one is that here we are not using the solve command. Instead, we are treating the line as an intersection of two planes.

Kitonum's code is as follows:

  1. L := [(x-2)*(1/3), (y-1)*(1/4), (z-3)*(1/3)]:
  2. plots[intersectplot](L[1]-L[2], L[2]-L[3], x = -4 .. 4, y = -4 .. 4, z = -4 .. 4, linestyle = 1, thickness = 3, axes = normal, orientation = [60, 75], view = [-1 .. 3, -4 .. 2, -1 .. 4]);

The first statement initializes a list L that contains all the desired expressions in the given symmetric form of the line.

In the second statement Kionum used the plots[intersectplot] command. This command graphs, in three-dimensional Cartesian space, the intersection of a pair of surfaces. This example uses the calling sequence: intersectplot(expr1, expr2, x=a..b, y=c..d, z= e..f, options)

What are expr1 and expr2 used in Kitonum’s solution? The pairwise differences of L[1] and L[2], and L[2] and L[3] are planes, the intersection of which is the desired line in space.

expr1 = L[1] – L[2] = (x-2)*(1/3)- (y-1)*(1/4)

expr2= L[2] - L[3] = (y-1)*(1/4)-(z-3)*(1/3)

The variables x,y, and z are the coordinate names and define the axes, whereas a, b, c, d, e, f define the ranges. In this case they were taken as -4 or 4.

In the options parameter Kitonum used linestyle, thickness, axes, orientation, and  view. The help page “plot3d,option” details these and other options that apply.

 

This blog was written by our intern Pia under the supervision of Dr. Robert Lopez. We both hope that you find this useful. If there is a particular question on MaplePrimes that you would like further explained, please let us know. 

How I can sketch a line with equation (x-2)/3 = (y-1)/4 = (z-3)/3 in three dimentional space?

Working on a code to create random lines. Here is the code: 

M:=1; N:=1500; R3:=rand(1..3): # M=lines, N=steps

for i from 1 to M do
X[i,0]:=0;
Y[i,0]:=0;
   for j from 0 to N do
   if j=1 then X[i,1]:=1; Y[i,1]:=0;
    elif j>1 then
      r:=R3();
        if r=1 then X[i,j]:=2*X[i,j-1]-X[i,j-2]; Y[i,j]:=2*Y[i,j-1]-Y[i,j-2]
        elif r=2 then X[i,j]:=X[i,j-1]+Y[i,j-1]-Y[i,j-2]; Y[i,j]:=Y[i,j-1]-X[i,j-1]+X[i,j-2];
        elif r=3 then X[i,j]:=X[i,j-1]-Y[i,j-1]+Y[i,j-2]; Y[i,j]:=Y[i,j-1]+X[i,j-1]-X[i,j-2];
      end if;
    end if;
   R[i,j]:=[X[i,j],Y[i,j]];
   K[i,j]:=[X[i,j],Y[i,j]];
  end do:
end do:

Now the code works fine. But I don't want the lines to cross its own path. I want it to stop if R[i,j]=R[i,k] for any 0<k<i-2 for j=0..N. What I have so far is:

for i from 1 to M do
  for j from 1 to 40 do
    R[i,j];
    for k from 1 to j-2 do
     if R[i,j]=K[i,k] then x:=j; print(b[i]=j); break; end if;
     L[i,j]:=R[i,j];
     end do;
   end do;
end do;

Now it works aswell, but it doesn't stop when it hits the crossing point. I want it to stop so i get one b[i]=j per M. So I need it to break two for loops so that it goes through i M times and stops everytime it reaches a crossing point

How I can write a procedure in Maple that return a equation of line that passes of two points (a,f(a)) and (b,f(b)) on the curve y=f(x) and the final plot y=f(x) and secant line in the same screen?

Hello!

I defined a line normally, but when I try plot this line in R3, appears a shape of a plane.

How can I plot only a line in a 3D window?

Line has coordinates x,y, e z.

 

Hi

Do the following equation solve by method of line(MOL) with this software?

du/dt=0.01 d^2u/dx^2

conditions:

u(x,0)=10

u(0,t)=0

u(1,t)=0

t=1,delta t=0.1,x=1,Nx=10

thank you

How can I plot a vertical line say x = a in Maple 15 worksheet?

Thanks

AoA... I want to plot the following functions

f(x)=sin(x)

g(x)=sin(x)-x+x^2

h(x)=cos(x)-sin(x)

I(x)=exp(x)-x

J(x)=sin(x)+exp(x)

in one coordinate having the line style and legend like attached file.

1-s2.0-S0377042714003331-main.pdf

PhD (Scholar)
Department of Mathematics

how to add another line in this template of formula

use the expression template  

how to add another line like

 

thank you in advance for your help

Hello.

I have a line integral and i want to calculate and graph this line integral.

The line integral comes from a physical problem, the integrand is good in the interval [0, 2*Pi] and the value of the integrand at zero = the value of the integrand at 2*Pi.

The problem is when i use the trapizidal rule to calculate the line integral.

The results is so bad, i.e.  the value of the line integral at zero not equal to the value of the line integral at 2* Pi.

where is the problem.

Any one could help me.

One would expect that hitting F3 will split from _end_ of the current line (where the cursor is at).

But what Maple does is actually split everything from the current cursor location. Which means if the cursor happened not to be exactly at the end of the line, the current line itself will also be split and broken.

It is much more logical to split starting from end of current _line_ (where the cursor is at), not current character, because that is what normally one would want to do. One will have large block of code, and want to split it from one line down to the end.  It is a simple usability issue, which Maple UI seems to suffer allot from.

Is there a way to modify this behavior? I keep hitting F3 and forget to move the cursor to the end of the line before, and end up wasting time having to fix things afterwords since the line itself is split.

 

 

1 2 3 Page 1 of 3