Why does my code only create points instead of lines?

In summary, the conversation discusses creating lines using the solutions of an equation. The first equation is a circle, while the second is a line. The code provided only creates points instead of lines, and the speaker asks for help in solving this issue. Later, they share that they have solved the problem by changing the code and explain how their new code works.
  • #1
button_ger
10
0
Hy Guys

I want to create some lines. That lines should be created by the solution of an equation. This equation has in my limits 1 or 2 solutions. The first euation is a circle.
The second is a line.

lineslope, radius, lineshift1, lineshift2 is defined before.

Code:
sol = Table[
  NSolve[{radius^2 == (x - radius)^2 + (y - radius)^2, 
    y == lineslope*x + i}, {x, y}]
  , {i, lineshift1, lineshift2, 20}]
Show[Graphics[Line[{{x, y}, {x, y}}]] /. sol]

This code only creates only points? Why? can anybody help me?

Greets
Jens
 
Physics news on Phys.org
  • #2
I have solved the problem.

I changed ...
PHP:
sol = Table[
  NSolve[{radius^2 == (x - radius)^2 + (y - radius)^2, 
    y == lineslope*x + i}, {x, y}]
  , {i, lineshift1, lineshift2, 20}]
Show[Graphics[Line[{{x, y}, {x, y}}]] /. sol]

in...

PHP:
sol = Table[
  NSolve[{x,y}/.{radius^2 == (x - radius)^2 + (y - radius)^2, 
    y == lineslope*x + i}, {x, y}]
  , {i, lineshift1, lineshift2, 20}]
Show[Graphics[Line[sol]]]

This did it. But how is the replacing function working right to replace the Line[{{x,y},{x2,y2}}] correctly?
 
Last edited:
  • #3
What you probably wanted in your original equation was:
Graphics[Line[{x, y} /. sol]]

I don't know how your new code is working for you, it failed for me.
 

Related to Why does my code only create points instead of lines?

1. What is Mathematica 7 lines solution?

Mathematica 7 lines solution refers to a specific method of solving mathematical problems using the Mathematica software. It involves writing a series of 7 lines of code in the Mathematica programming language to find the solution to a given mathematical equation or function.

2. How does Mathematica 7 lines solution work?

The Mathematica 7 lines solution works by using a combination of built-in functions, algorithms, and symbolic manipulation to solve mathematical problems. The 7 lines of code are carefully crafted to accurately represent the given problem and produce the desired solution.

3. Is Mathematica 7 lines solution accurate?

Yes, Mathematica 7 lines solution is known for its high level of accuracy. The software uses advanced algorithms and symbolic manipulation techniques to ensure precise solutions to mathematical problems. However, it is important to input the problem correctly and use appropriate functions to get accurate results.

4. Can Mathematica 7 lines solution handle complex mathematical problems?

Yes, Mathematica 7 lines solution is designed to handle complex mathematical problems. The software has a wide range of built-in functions and capabilities that allow it to solve a variety of mathematical equations, including those with multiple variables, differential equations, and more.

5. Do I need to have programming experience to use Mathematica 7 lines solution?

No, you do not need to have extensive programming experience to use Mathematica 7 lines solution. The software has a user-friendly interface and provides helpful documentation that can guide you through the process. However, some basic understanding of the Mathematica programming language may be beneficial in using the software effectively.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • Advanced Physics Homework Help
Replies
5
Views
825
  • Precalculus Mathematics Homework Help
Replies
2
Views
917
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
304
  • Calculus and Beyond Homework Help
Replies
8
Views
508
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • Linear and Abstract Algebra
Replies
2
Views
893
Back
Top