Topic: Slope Field Request

Is there any plan to create slope fields in Graph? I use graph a ton to make my handouts for my AP Calculus classes. Having a slope field feature would be a great addition to the program. If I knew anything about creating a plugin, I would try and do so and share it. However I'm finding it difficult to begin doing so with the limited coding knowledge I have.
If there's no plan to incorporate plotting slope fields in graph, do you think you could point me in the direction of some resources to teach oneself to do so?

Thanks,
Marco

Re: Slope Field Request

Plotting Slope Fields using Graph 4.4.2
(Parametric representations for slope fields)

Post's attachments

example.png, 6.93 kb, 500 x 500
example.png 6.93 kb, 1141 downloads since 2017-01-27 

Re: Slope Field Request

I don't currently have any plans for implementing slope fields in Graph. But I can see that benice has found a way to do it with Graph.

If you want you could create a plugin that creates an interface for plotting slope fields but just does the same as the examples created by benice. A good starting point would be the Circle.py example plugin installed with Graph. It creates a dialog for inserting a circle, but it is actually just uses a parametric function.

Re: Slope Field Request

Ivan,
     I have attempted a plugin based on the Circle.py and Benice's file. I appreciate your direction and Benice's file to work from.
     The only issue is that when zoomed in, the slope segments sometimes join together. I don't know how to fix that. I also noticed that I can not append the attribute of step size to a parametric function. Is this possible? If so I was not able to find it in the documentation.
      If anyone can figure out how to make sure the slope segments don't join when zooming in, and tell me how to fix it I would like to fix that bug.

-Marco

Post's attachments

Attachment icon Slopefield.py 4.28 kb, 1973 downloads since 2017-04-25 

Re: Slope Field Request

I think I fixed the connecting segments. Check out the following plugin. I changed the draw type to dots, and figured out the Func.Steps issue.

Post's attachments

Attachment icon Slopefield.py 4.4 kb, 2126 downloads since 2017-04-25 

6 (edited by marcorainaldi 2017-04-27 18:22:28)

Re: Slope Field Request

I added the ability to define the region in the plane for which the slope field will be plotted. The user can now enter the x-min, x-max, y-min, and y-max of the rectangle in which the slope field will be plotted.

In order for the slope segments to be of uniform length, the graph must be zoomed square (Ctrl+Q)

Post's attachments

Attachment icon Slopefield.py 5.39 kb, 1980 downloads since 2017-04-27 

Re: Slope Field Request

I am glad you figured it out. Draw type needs to be Dots in this case. Lines will connect all the points, while the default Automatic tries to be smart and connect them if it thinks it makes sense.

It is a really impressive plugin you have created.

Re: Slope Field Request

Ivan, I appreciate your help in directing me to the circle plugin to create the slope field plugin! I enjoyed making a new plugin!

I'd really like to take a shot at making more plugins, but I haven't had luck in digging up examples of the vcl components I'd like to use in a dialog like the ones I mentioned above.

I was wondering if you could post a couple of rudimentary plugins in Python that have dialogs that use the vcl modules that are used in the built in dialogs of inserting a point series and inserting a function. I've been searching on my own, without luck. Granted, I'm no software engineer, and have beginner level programming experience.

If you could produce a couple of plugins to work off of like the circle plugin, that would be great! If not, I understand.

Thanks for making such a great program, and making plugins possible!

Re: Slope Field Request

There are 3 other plugins installed with Graph that uses dialogs: Revolution.py, Statistics.py, Transform.py

I assume you know that there is a help file with scripting engine documentation installed with Graph. You can also find it online:
http://www.padowan.dk/doc/PluginDoc/

Embarcadero has a lot of documentation for the VCL:
http://docwiki.embarcadero.com/VCL/en/Main_Page

Unfortunately all documentation and examples for the VCL is in either C++ or Delphi. The VCL bindings for Python was something I made for the scripting engine in Graph. I understand that the VCL documentation can be difficult when you don't have experience with the library.

If you are having trouble with something in the scripting engine or VCL, please ask.

Re: Slope Field Request

I have run into something while using the plugin, that might be a bug with Graph. It might be not be with Graph itself, but how MS Word and Graph get along.

I use Graph oftentimes when writing exams in Microsoft Word. I can insert a Graph System Object to my Word Document, and insert a Slopefield, without issue.
If I open up the Graph object to edit the slopefield, and change the equation, the slopefield updates/redraws in Graph, but does not update in Word.
However, if after editing the slopefield if I ZoomSquare, or Resize the Graph Window, the Graph will update in Word, even while I'm still editing it.

It's not terribly inconvenient to work around, but I thought it might be something you would like to be aware of.

Re: Slope Field Request

Thanks for telling me. Yes it is a bug in Graph. Apparently I never tested the plugin system with embedded objects. I will get the problem fixed.

Fortunately as a workaround you can use Graph.Update() instead of Graph.Redraw(). Update is much slower than Redraw, but probably not enough to be a problem. Alternatively you can press F5 for force an update.